r/statistics • u/outrageously_smart • Apr 19 '18
Software Is R better than Python at anything? I started learning R half a year ago and I wonder if I should switch.
I had an R class and enjoyed the tool quite a bit which is why I dug my teeth a bit deeper into it, furthering my knowledge past the class's requirements. I've done some research on data science and apparently Python seems to be growing faster in the industry and in academia alike. I wonder if I should stop sinking any more time into R and just learn Python instead? Is there a proper GGplot alternative in Python? The entire Tidyverse package is quite useful really. Does Python match that? Will my R knowledge help me pick up Python faster?
Does it make sense to keep up with both?
Thanks in advance!
EDIT: Thanks everyone! I will stick with R because I really enjoy it and y'all made a great case as to why it's worthwhile. I'll dig into Python down the line.
View all comments
Show parent comment
18
u/[deleted] Apr 19 '18
Why would you choose to use the subset function over data.table if it has it's own very fast subsetting in i? What is the point of doing a comparison if you invested no time in understanding the tool? :o
If you want fast subsetting in data.table you should set key beforehand with setkey, if not it should be slower on the first iteration but IIRC it caches the subset for subsequent ones.
Moreover - looping for testing is a nono, you have special libraries for that with proper timing tools - ie microbenchmark.
I did a quick test on made up data and it doesn't align with what you wrote.
If you want to do a test that has any sensibility in it please learn the tool so you are using it properly and also please don't go for loops as default in R, it's not idiomatic.