For the past three years I have been chipping away at R — going up what has been a very steep learning curve. For the most part, it has been a fun (if nerdy) pass-time — characterised more by satisfaction than frustration. The aim of this post is to help new users get onto a track that will ultimately be fruitful.
The difference between R and excel is somewhat like the difference between a terminal (or shell) operating system and a GUI (or Windows) operating system. For like the terminal, R is not ‘user friendly’ AND in the right hands it is extremely powerful.
So my first bit of advice is to get comfortable in the shell. Real power-use of a computer (regardless of if you are using R or not) requires some heavy lifting in a ‘terminal session’ — being comfortable in this environment is a necessary condition for getting really useful in R.
If you need to brush up on the shell, do the CLI course at Zed Shaw’s awesome ‘Learn Code the Hard Way’ site.
Next, pick a text editor: my advice is to choose one of vim or emacs and to just stick with it.
Using R is really about cutting code. When I’m ‘using R’, I’m not really doing much in the R GUI — I’m tinkering away inside Vim, with an R session open. I write a little bit of code in vim, test it in the interactive R session, and then when satisfied save that chunk some place and repeat on the next part of my task. At the end of a few hours I have a working R script.
There are two very good reasons that you should pick one of emacs or Vim:
1/ both have vibrant communities that will help you when you get stuck (and you will get stuck).
2/ both are robust programs with robust communities. Sure — everything dies at some point, however these two communities seem very robust. You are going to spend a lot of time with your editor, and you don’t want to be stranded with 2000 hours of experience with an abandoned editor. Both editors are freakishly awesome, and do much the same thing (which is why the conflict between the two groups are so heated).
If all this sounds too hard (and it is hard; Zed Shaw, for example, recommends you steer clear of vim and emacs at first), you can get most of the way there with the excellent Rstudio.
I know, this seems a long way away from R, but it’s actually right on case.
Why use R? I can tell you why you should — because if you use R you will create robust, repeatable, reliable work. To get there, you are going to have to become something of a programmer.
For really using R is writing and testing code. To get good at it, you are going to have to write and test code for many hours.
So you if you are going to have spend many hours being like a programmer, you should get a text editor professional programmers use. It’s hard at first (particularly vim), but you can look forward to your first nerdy first pumps when you learn how to customise your editor to make life a
little LOT easier.