The point, then is to supply code with simple instructions so that anyone can run it. Secondary goal: write it in a language a human can actually read.
If you're doing science and you want people to understand your code, you use Python, not R.
The point, then is to supply code with simple instructions so that anyone can run it. Secondary goal: write it in a language a human can actually read.
If you're doing science and you want people to understand your code, you use Python, not R.
Wouldn't that depend on which language "people" know?
> Its the PHP of Data Science.
Some might disagree with that statement. Some might even argue that languages where for loops are idiomatic and strongly promoted by the BDFL are the PHP of Data Science.
Further, the vast majority of R modules are at least partially implemented in R and tend to be very readable.
python: X.dot(Y)
matlab: X*Y
R: X %*% Y
It makes less difference when it's only 2 matrices, but when it's 3+ it's far more readable.pandas has a lot of functionality, but the interface is far inferior to R's data frame, where you have
df[row predicate, column predicate]
particularly the highly useable intermingling of column access by index or name. reshape2 and plyr are, imo, far more elegant and less wordy apis.The api to sklearn, while definitely more consistent than R's apis, has a lot more programmer nonsense interjected: imports of random packages, the difference between pandas and numpy that still peeks through the second you step outside of statsmodels, etc.
numpy has a serialization format, while pandas uses pickle or hd5. R just uses save/load, and unlike pickle in my experience, it reliably works.
matplotlib is an ugly api, particularly compared to ggplot.
- python 3 (.5?) is adding the @ operator for matrix multiply. Of course this only helps you if your company uses python3
- There are 2 packages (seaborn, ggplot(clone)) which sit on top of matplotlib and provide a much nicer interface for statistical plots
FWIW, I've done both Python and R and they both have their pluses and minuses, but beauty is in the eye of the beholder and I've seen some R packages that do, indeed, make R beautiful, case in point, the dplyr package from Hadley Wickham. I'd love to see the future of R be inspired by dplyr and ggplot.
[1] -- http://technology.stitchfix.com/blog/2015/03/17/grammar-of-d...
The language matters. One is optimized for ... honestly I have no idea what R is optimized for. I don't think R works that way. It just is. Python though, its optimized for readability.
R is optimized for statisticians
R and Python really are very similar as languages. R is more functional, but that shouldn't impede your ability to understand code (once you master some of the basic idioms of FP)
PHP is the canonical reference for code which can be understood but not interpreted, because you don't know the values of various obscure global flags.
R isn't horrible, and if you are in the repl, you can print any function's code you can access, which is awesome.
(It's a pet peeve of mine. The language is called "C++". "cpp" is commonly used as the suffix for C++ source file names, but the name "cpp" also refers to the C preprocessor.)