4 ms·
Fast Lane to Learning R
- mechanical_bear 5y agoIf I'm already productive in Python doing similar analysis, is there a good reason to switch to R?
- mistrial9 5y agoit seems the author has something to say about that: https://github.com/matloff/R-vs.-Python-for-Data-Science https://github.com/matloff/R-vs.-Python-for-Data-Science
- mechanical_bear 5y agoThanks for that!
- notafraudster 5y agoI write code in both daily. I don't think there is a burning need to know both, but there are definitely tasks each is good at. The RStudio IDE is really quite wonderful for interactive stuff. The pipe operator (allowing left to right evaluation of function chains) makes for extremely literate code. Most of the basic statistical functions are substantially better than their Python equivalents. Many of the ways in which you use Python for data science stuff are just poor imitations of R (in particular, pandas is a take on R's data frames that is imo not as productive). In some conditions R can be faster [in others, slower]. The R package ecosystem for more off the beaten path statistical stuff is better than the Python package ecosystem (if you're doing more intense ML and CNNs, the opposite is true). If you're doing dashboards, Shiny is great. But in each case, you can basically work in either language and you'll be fine. 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.
- nojito 5y agoLess code to get the same result and r markdown is infinitely better than anything in the python ecosystem
- lmc 5y ago> And r markdown is infinitely better than anything in the python ecosystem You might want to check out Quarto [1], which i recently discovered on here [1] https://quarto.org/ https://quarto.org/
- nojito 5y agoYes! Quarto is absolutely game changing. I hope it becomes standard place in analytics.
- t_mann 5y agoPython vs R is the new Matlab vs R (and soon it may be Julia vs R). 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.
- temp8964 5y agoYes. There are a few cool things only exist in R: - R Shiny - RStudio Jobs - RStudio Server - RMarkdown, Blogdown, Bookdown, etc.
- p10_user 5y agoPython is great for plumbing, R is great for new analyses. I use Python to knit Rmarkdown documents from premade templates. 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
- civilized 5y agoBase R only? tapply? Ick, no thanks. New R programmers should learn tidyverse https://www.tidyverse.org/learn/ https://www.tidyverse.org/learn/, not just base R. There are a lot of R programmers (including the author of the OP, apparently https://github.com/matloff/TidyverseSkeptic 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.
- notafraudster 5y agoI agree that new R programmers should start with the tidyverse, though actually the first element of the tidyverse I'd teach is the pipe and that's now part of base R; the second element I'd teach is using the readr stuff mainly to not have to worry about stringsAsFactors and stringsAsFactors is now default off. 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.
- yCombLinks 5y agoI've taught a lot of people programming, and frequently work with novices. Functional concepts are nearly universally a sticking point for learners. For loops haven't caused any more trouble than the other basic concepts in my experience. It's an order of magnitude more difficult for learners.
- civilized 5y agoLoops are very easy to debug in R. When they break and they're not inside a function, your REPL state is set to exactly what the environment was before the loop broke.
- Dyac 5y agoIf the goal here is becoming productive quickly, try https://exploratory.io/ https://exploratory.io/ which is a sort of WYSIWYG environment for R that will still let you code by hand if needed. No affiliation, just a happy customer for 2 years.