6 ms·
Start here to learn R
- minimaxir 10y agoAll the tutorials involve using base R packages. While OK for a tutorial, this is not reflective for real-world data analysis both in performance and usability, a lesson I have learned the hard way. (After using it for three semesters in college, I almost quit R completely in frustration) I recommend going straight to the Hadleyverse packages for the common use cases, and read the vignettes for the common use cases: readr for reading files, dplyr for manipulating data, ggplot2 for plotting (the most important package!), and tidyr for reshaping data into a ggplot2-friendly long form. Wickham himself has a very beginner-friendly, free book for learn R using his packages: http://r4ds.had.co.nz/index.html http://r4ds.had.co.nz/index.html (far better than any tutorial I could write)
- crispyambulance 10y agoThe Hadleyverse is the best thing that ever happened to R: sane, intuitive tools that do what you expect with common-sense usage and examples. And don't forget stringr!
- IndianAstronaut 10y agoStringr is probably the one tool from the Hadleyverse that removes the most frustration. String manipulation and parsing in base R is nightmarish.
- dandermotj 10y agoGo one step further with Wickham's purrr too. Offers well developed functional programming tools!
- projectramo 10y agoThanks for mentioning this. I have used dplyr, ggplot2, and a little of some others but I had no idea about Hadley and that they all worked together.
- hadley 10y agoNo idea about Hadley?! Oh the horror :p
- projectramo 10y agoBut I'm probably two degrees removed from you. Currently in Houston, and studied with your fellow kiwi Craig (Rutgers) on the east coast.
- hadley 10y agoBtw it's called the tidyverse now ;)
- R_haterade 10y agoWhile I appreciate the hard work Hadley has put into this ecosystem, and I detest the language wars, I can't help but feel that the world would be a better place if Hadley had put his effort into python DS modules instead. Hadley's work puts R almost at parity with python (at best!) for munging, and for academics, this long-term trend of domain languages like R or SAS becomes counterproductive. It's as if he's leading us to a local optimum.
- eanzenberg 10y agoHadley's packages seem geared more towards data munging and transformations (I regularly use plyr and ggplot from the 'verse) and not machine learning. In my experience R has better implementations of machine learning algorithms than sklearn and rstudio is a better ide than any I found in python.
- projectramo 10y agoNot arguing that your statement is right or wrong, but I suggest checking out Spyder for python. I go back and forth between the two, and though I hate the syntactic gear shift, they are quite similar.
- eanzenberg 10y agoI have tried Spyder before. It was too buggy and crashed a few times on some light scripts. This was around June 2015.
- RA_Fisher 10y agoS (R's ancestor) was developed in the mid-70s and 80s, at least a decade before Python was written. Then couldn't your argument be applied to those working on Python data science tools? Variety is the spice of life. :)
- jhbadger 10y agoNo, because the issue isn't that new programming languages and their libraries shouldn't be developed (and I'm a big fan of new languages with new paradigms) but whether the new languages should be general purpose or not. I'd argue that the development of S was misstep, and one which would have been completely forgotten by now if not for R and the libraries written for it.
- vobios 10y agoWithout experiencing base R, you won't appreciate the tidyverse packages, which tend to have more of a learning curve. For example, you can just run boxplot(x) in base R and it will make you a plot. Only after trying to make any modifications to it that you will see the benefit ggplot2. As you mention yourself, "I almost quit R completely in frustration". I believe that is exactly why you appreciate the other packages you mention.
- hatmatrix 10y agoFunny you mention this as an example. I find ggplot2 good for exploratory analysis on a data frame with many categorical variables that can be used for faceting/conditioning or grouping. When trying to make any modifications to its appearance, I usually return to base graphics.
- haddr 10y agoSame here. ggplot is nice, but whenever I need to do something more complex i suddenly find myself on stackoverflow. Base graph is super easy and usually get things done, even lattice is somehow more intuitive. ggplot when comes to details, seems awkward to me.
- mastratton3 10y agoAgreed, I almost use base r exclusively during exploratory work and move to ggplot only when I want to present a finding... I guess you could say its in-efficient but it seems to work.
- vegabook 10y agoI could not disagree more. Base graphics are absolutely intuitive for users coming from an imperative style, and base graphics are extremely fast, which is seriously useful a lot of the time. This is not to say I dislike ggplot, I love it, only that it is not the starting point for learning R because its syntax really is not idiomatic R. You'd be imposing two orthogonal learning curves on the new user. Second, while dplyr et al are fantastic, it is really important to understand the "functional" aspects of R which are much better learned via the simple apply families.
- hadley 10y agoI disagree. The inconsistencies across the apply family makes them hard to learn, and the absence of an apply function for data frames is particularly frustrating. I obviously also disagree on what is idiomatic R. If you know ggplot2, there are a relatively few advantages to learning base graphics, if you're mostly interested in graphics for data analysis.
- vobios 10y ago"If you know ggplot2"... but you need to make a lot of plots to get the hang of ggplot2. The "+" syntax (not sure what the proper name for that is) alone is completely foreign and intimidating. If you want to make great graphs in R, you will need to learn ggplot2. If you just want to learn R, why not keep it simple at first?
- hadley 10y agoBecause the chances are you learning R to do data science/analysis. And you're best off spending a little extra work to learn the tidyverse - that investment pays off with an ecosystem of tools that all fit together to help you solve the problems you are mostly likely to want to solve.
- deleted 10y ago[deleted]
- vegabook 10y ago
- haddr 10y agoWhile I would say it is really important to know some basics, such as data.frame, *apply methods, etc. I also admit that as soon as possible I jump to data.table & dplyr when nobody's watching.
- baldfat 10y agoI find this to be a great list of resources. https://www.rstudio.com/online-learning/#R https://www.rstudio.com/online-learning/#R For the Hadleyverse or Tiddyverse this is a starter book based on dplyr and other tools. Hands-On Programming with R http://shop.oreilly.com/product/0636920028574.do# http://shop.oreilly.com/product/0636920028574.do#
- IanCal 10y ago> If you’re completely new to R, we suggest you simply start with the first topic, “Simple manipulations; numbers and vectors”. Where is this? I couldn't see anything with the same name. The first thing in the list: http://r-exercises.com/2015/10/09/vector-exercises/ http://r-exercises.com/2015/10/09/vector-exercises/ starts by telling me I need to have read something else, which is a chapter in a long PDF. I applaud the effort, but this feels confusing and I'm worried about people being discouraged right as they start.
- projectramo 10y agoThese are interesting exercises. I would also add that what it means to learn, or begin to learn, a language in general but R in particular could vary widely. Some people actually need to learn statistics while they are learning to express those concepts. Some people need to learn idiomatic R. I really didn't think of R as very functional till I took Peng's (excellent) Coursera course. Some people need to get a sense of the libraries available. This is an intro to get some practice in the the classical, original purpose for S, Splus and R: linear algebra operations in R.
- partycoder 10y agoA paid alternative is also datacamp.com Has videos and interactive exercises you can do directly in the site. And btw, I am not affiliated with them, just a user.
- huac 10y agoFriends and coworkers have also recommended Datacamp highly, though I've never used it.
- harmegido 10y agoI thought they were very smart to put a link to datacamp.com in the load message of data.table.
- sndean 10y agoI've found DataCamp to be pretty good too. Have you tried DataQuest [1]? It's mostly Python (a little R), but just wondering what others think. [1] https://www.dataquest.io/ https://www.dataquest.io/
- smortaz 10y agoif you are on Windows and want to try R and don't mind preview software, check out: http://microsoft.github.io/RTVS-docs/ http://microsoft.github.io/RTVS-docs/
- RockyMcNuts 10y agoAlso swirl (similar exercises to teach yourself R) http://swirlstats.com/students.html http://swirlstats.com/students.html
- Jon_Maxwell 10y agoI personally prefer video courses, like those on Udemy: https://www.udemy.com/data-science-and-machine-learning-bootcamp-with-r/?couponCode=DATASCIENTIST https://www.udemy.com/data-science-and-machine-learning-boot...