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
3
u/bjorneylol Apr 20 '18
Thanks for the tips, had no idea about range. Removing the $ operator in the aggregation really did speed things up substantially on the groupby
What I'm seeing now is basically equivalent performance when working with pandas categories. I know at least that last set of benchmarks you posted are using 0.14, and I can certainly say pandas has come a long way since them (0.22 four years later). When you get down to the metal data.tables and pandas are likely using slightly different implementations of the same C algorithms for all their subsetting/joining, and any speed difference is likely due to overhead in the dataframe/table classes and/or the language. I haven't tested merges and sorts, but I wouldn't be surprised it would be similar performance along an int64 index, with R outperforming on text data (Last time I checked, pandas converts categorical columns back to strings for a lot of operations, so the conversion to or from would kill speed).
The dt[x==y] syntax is a lot faster
Similarly removing the $ operator speeds up the groupby a LOT