DEV Community

Rohit Farmer
Rohit Farmer

Posted on

3

Learning R: Rant 2

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 Than One Way To Do It (TIMTOWTDI)". Although I appreciate this philosophy as it opens up the possibility of adopting multiple ways of doing the same thing. It becomes problematic when multiple people are working on the same project or worse if you are taking over someone else's project. Understanding the code becomes a pain in the back. Python, in this case, is a good language because it is more readable to a human and there are pretty much-set things on how to solve a particular kind of problem. Packages in R also have too many overlapping functions that mask each other in the order the packages are loaded. Therefore, you always need to be cautious about a function's source before calling it.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (1)

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

Billboard image

Try REST API Generation for MS SQL Server.

DreamFactory generates live REST APIs from database schemas with standardized endpoints for tables, views, and procedures in OpenAPI format. We support on-prem deployment with firewall security and include RBAC for secure, granular security controls.

See more!

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay