DEV Community

Learning R: Rant 2

Rohit Farmer on May 08, 2019

Continuing my rant series while I am learning R. R is pretty much like Perl in terms of the philosophy that they follow; that is "There Is More Tha...
Collapse
 
daveparr profile image
Dave Parr

Ha. I like this one.

Yes. No one ever wrote the 'Zen of R' (or at least wrote it in time to impact the core language). I think this just has to be a human managed thing. Again, as per your last post, which I also agree with, use tidyverse.

It's been designed specifically to be consistent and in some opinions 'human readable'.

Pipes! now you read left to right, no nesting. How human :)
Only functions that get masked are from base, tidyverse doesn't internally mask itself because it's written by the same devs (RStudio).

Also if you're working in a team with people, it's always useful to settle on 'conventions'. I think you could probably argue that you could do things in multiple ways in python. e.g. how many plotting libraries are there? Seaborn, plotly, matplotlib and bokeh all sort have a take on it. Admittedly in R we have a few ways to skin the cat, but if you put ggplot code in-front of someone who's used R in the last 10 years, they will get it immediately.

Pain points I do see a lot though still:

  • using the dollar sign to reference a column in a table. Really shouldn't be done any more IMHO
  • understanding the difference between [x] and [[x]]
  • confusing intermediate assignment

And my pet one:

  • package management It's gone so far on this that we're learning from python as some of the core devs have started renv