How I Learned R
Yihui Xie / 2017-12-09
This week a neighbor of mine told me he wanted to learn R, and asked me how I learned R. I realized I had never blogged about it, so here we go. I learned R through a rather unusual way: I mostly learned R by answering other people’s questions.
R was introduced to me in 2004 in a course on statistical computing when I was an undergraduate. Before that, we were taught a little bit S. We didn’t learn these languages systematically, but that was fine. After you learn what a numeric vector is and how to write a for loop, you can already do a lot of things.
Most of my classmates didn’t continue to learn R after the course, but I did, mostly because I built a web forum in Chinese, and some people asked questions there. Of course, I was not knowledgeable enough to answer all questions, but I knew how to use two things: the R help pages, and Google. Through this process of finding answers for other people, I learned a lot more about R. I just kept doing that for a couple more years. And “a couple more” is 13 — Yes, this web forum is still alive, and I’m still answering questions there, although I’m no longer able to answer that many.
To be honest, I have never finished reading a single tutorial or book on R. There was only one exception: in 2007, I felt I should read something like that, so I went to the contributed documentation on CRAN, and hoped to read at least the short documents one by one. I started with the first one, “Using R for Data Analysis and Graphics – Introduction, Examples and Commentary”, written by John Maindonald. I finished it, found some minor mistakes, and wrote to John.1 Other than that 100-page document, I haven’t managed to finish other documents or books. That is why I don’t have an answer when beginners ask me for recommendations on R books.
In the early days, I was motivated to answer questions because of praises. Not many people knew R at that time in China. I became an “expert”, although they didn’t know that I was just doing copy-and-paste from R help pages and Google searches.
Charlie Munger seems to quote Benjamin Franklin frequently:
“If you would persuade, you must appeal to interest rather than intellect.”
I think the same idea can be applied to learning something new: you can appeal to interest (in the sense of advantages or benefits) instead of other things. The “interest” in my early days was the praises. I felt good about them. That is it.
BTW, this also explains my reward to Yihan on Stack Overflow. It is good to see beginners help beginners, and this behavior should be strongly encouraged.
That was how we got to know each other. Seven years later, I invited him to give a talk at the China R Conference in Beijing, and we met for the first time in person there. ↩︎