Saturday 5 May 2012

How do you learn R?

Now I run a self-study group in R. The question I often come across is ‘How do you learn R? How much time did you spend learning this?’ Since then, I would like to share my learning experience. Please bear in mind that different people learn the same thing in different ways. My way of learning R might be different from yours, but if you can get some useful tips from my learning experience, I would be delighted to see the growth of R users.

R is a steep learning curve. It’s fairly easy to get started by using R manual. However, when you want to learn different R packages, you may find it difficult. A friend of mine once told me, 'there are no difficult questions, only poorly defined questions.' I agree. If you find it difficult to learn a specific R package, there are two questions that you need to ask yourself:

  • Do I understand the algorithms of this package or this function?
  • Do I understand the coding of this function?

Once you complete the R manual, I would not say you will have difficulties in understanding most of R coding. However, R manual wouldn’t be able to include all sorts of algorithms that are applied to all packages in R. This suggests that finding it difficult to learn a particular R package possibly means that you have difficulties in understanding the underlying algorithms. In other words, if you don’t know when you should use a particular function, you have problems with algorithms instead of R itself. This is where the package manual comes in. In the manual of each package, it introduces the algorithms it uses, providing leads that you can use to search in Wikipedia or YouTube or Google. Thereafter, you can find the relevant sources for algorithms to learn.

The package manual has the other function that it tells you what function does what, what parameter is required for what function, what parameter indicates what, and etc. Moreover, you can also use the examples in the manual to see how each function works. If you learn by using, the package manual is there for you. Also, ‘help()’ and ‘?’ are very useful. They extract the relevant piece from the manual and give your examples.

As I said before, different people learn in different ways. If you feel more efficient learning alone, you can do what I just said. If you feel more efficient learning in a community, you also have other options. R is open-source software and has a large user-community. I often go to R presentations, read r-bloggers and ask questions in a discussion forum if I have any. I also share my learning experience with other R users and we all learn from each other.

The last thing I would like to say is that when you learn R, you need to focus on the big picture instead of details. Manual is there to solve the details, whereas your mind needs to pay attention to the big picture, which may include:
  • What a package does
  • Under what circumstances you should use what function
  • What the underlying algorithm is


If you feel you get lost or difficult to keep learning, then you need to stop and step back to review what you learned and what is there in your big picture. Get the big picture before you get into details. In the end, thank Eugene for proof-reading and assisting me with running this self-study group.

No comments:

Post a Comment