# Why R for data science – and not Python?

**R-Bloggers – Learning Machines**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

There are literally hundreds of programming languages out there, e.g. the whole alphabet of one letter programming languages is taken. In the area of data science there are two big contenders: R and Python. Now why is this blog about R and not Python?

I have to make a confession: I really wanted to like Python. I dug deep into the language and some of its extensions. Yet, it never really worked for me. I think one of the problems is that Python tries to be everybody’s darling. It can do everything… and its opposite. No, really, it is a great language to learn programming but I think it has some really serious flaws. I list some of them here:

`print`

command got changed!`install.packages()`

(I know, this is not entirely fair, but you get the idea).`any(df2 == 1)`

gives the wrong result and you have to use e.g. the method `(df2 == 1).any()`

. Very confusing and error prone.library(Rcpp) bmi_R <- function(weight, height) { weight / (height * height) } bmi_R(80, 1.85) # body mass index of person with 80 kg and 185 cm ## [1] 23.37473 cppFunction(" float bmi_cpp(float weight, float height) { return weight / (height * height); } ") bmi_cpp(80, 1.85) # same with cpp function ## [1] 23.37473

One of the main reasons for using Python in the data science arena is shrinking by the day: Neural Networks. The main frameworks like Tensorflow and APIs like Keras used to be controlled by Python but there are now excellent wrappers available for R too (https://tensorflow.rstudio.com/ and https://keras.rstudio.com/).

All in all I think that R is really the best choice for most data science applications. The learning curve may be a little bit steeper at the beginning but when you get to more sophisticated concepts it becomes easier to use than Python.

**leave a comment**for the author, please follow the link and comment on their blog:

**R-Bloggers – Learning Machines**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.