Fast Lane to Learning R
github.com
github.com
There are a lot of R programmers (including the author of the OP, apparently https://github.com/matloff/TidyverseSkeptic) who are used to the old way of doing things and allergic to tidyverse. But the base-R only, anti-Tidyverse attitude is going the way of COBOL.
I have worked full time in R for many years and it is no contest.
I agree with the author that one must learn vectors and subscripts, but that is not an excuse to shove dplyr under the rug. It is an easier way to do lots of things.
Still, I think ggplot is a better way of thinking about plotting than base R's multiple and not very coherent plotting systems, dplyr beats the pants off any kind of base tools for manipulations, a lot of the tibble/pillar display stuff is great, and personally I disagree with Norm and think functional programming is as accessible as loops are to novice programmers.
I think FP is good for more concisely expressing simple stuff that's unlikely to break. Don't really believe in using it as a complete replacement for loops.
Or - once you’ve found what element in your list is causing the issue- extract it and feed it to your function with your debugger on.
Admittedly I have often had a more challenging time fixing FP code than if I had used a for loop. This might be because I am not as familiar/comfortable with FP than procedural flow.
There has to be a for loop eventually. But crawling through a for loop within a procedure can also be painful if there are many different case scenarios. You could counter that good code wouldn’t suffer such a problem, but if the code was good it might not have been broken!
The problem is that is teaches people the "wrong" * way to use R. I agree for loops are easier to understand, but when nearly the entire R universe operates on vectors, you end up with students who will do R the hard way their entire career.
If you surveyed most R users (verses R programmers) I would say the majority would be unaware that the base type is a vector.
* I know there is no wrong way to do anything, but I have seen plenty of times for loops simply applying an already vectorized function to each element of the vector.
I'm not against it at all, in fact I was doing nearly all of my work in dplyr, reshape, ggplot,... and I second that it's much more convenient and intuitive than the various apply's,...
My impression was that it was quite political and Hadley Wickham had antagonized some people in the core R community (and tbf, it was a bit annoying with him introducing redundant packages, reinventing and relabelling multiple ways of doing the same things, and presenting each new iteration as the end-all-be-all).
Re: antagonistic behavior, I would just recommend that all participants consider the old glass houses proverb as applicable to themselves, and try to do better going forward.
The experience between using the two is night-and-day. I would rather use the cli than base R at this point, and am convinced that the only proponents of base R over the tidyverse haven’t tried the latter for themselves.
Here are some benchmarks: https://h2oai.github.io/db-benchmark/
I have plenty of projects with tables with millions of rows, and I rarely find dplyr to be slow enough to get frustrated about. And even then I'd rather endure, or maybe use dtplyr, or maybe use data.table for a small performance-critical part of the code, than make a wholesale switch.
I just enjoy having to read much less code when compared to tidyverse and SQL.
Plus the syntax difference between tidyverse and dt are overstated.
I could get used to it, I'm sure. I could also get used to doing everything in base R, pandas, or Clojure. Doesn't mean it's a good use of my time.
I get the sense from how some people blog that basic "filter + group by + summarize" type pipelines on giant datasets are all they really do. data.table may be a great choice for that kind of thing. But I use dplyr as a tool of thought. I can solve complex, novel data processing and analytics problems in dplyr more precisely and efficiently than I can explain in words. Instead of having an idea and then having to think about how to code it, the ideas translate into dplyr in an obvious and automatic way.
All that said, data.table's authors have worked much harder to provide advanced functionality, most notably non-equijoins, that it looks like the tidyverse may never catch up to. So if you need that kind of thing a lot, you need data.table or maybe DuckDB.
No affiliation, just a happy customer for 2 years.
I think it makes more sense to think of R as replacing Stata, SPSS, SAS, and to a lesser extent Matlab, rather than replacing Python.
Julia is also fun.
You might want to check out Quarto [1], which i recently discovered on here
My answer is always the same: there are a few excellent and quasi-standard packages/libraries that exist in one of them without fully equivalent analogues in the others, so if you need any of those then go with that system (eg Simulink in Matlab, tons of classical statistical models in R, some ML/DL libraries in Python). In fact, you might have to use multiple systems if your problems are complex enough and you don't want to compromise. If you don't fall in that category, then just stick with what you have, any of those languages are decent enough general purpose tools and the differences don't justify a codebase migration.
- R Shiny
- RStudio Jobs
- RStudio Server
- RMarkdown, Blogdown, Bookdown, etc.
Of course you can achieve something similar with Jupiter notebooks. The real benefit is the perceived ability to get going with a new dataset.
With respect to massaging and visualizing rectangular data, I can get much further much faster in R tidyverse than python. Just as we see python as a language that allows for rapid development with its straightforward syntax - I see R tidyverse providing a faster data analysis exploration “experience”. Tidyverse also introduced me to functional programming which I have found to be very useful for data analysis; you can very strictly separate procedures in a way I have found beneficial. (Not to say you cannot acquire this knowledge another way, however.)
I remain an avid user of pandas data frames inside the python ecosystem. On more than one occasion, I have translated rapidly written tidyverse data wrangling routines into more maintainable functions in python with pandas.
YMMV