Skip to Content

How to Learn R

RevoJoe's picture

The R programming language was designed for doing statistics. In my view, its great popularity among statisticians, people learning statistics, data miners and others is due to the way it facilities the process of thinking about statistics. R’s syntax greatly aids in expressing statistical models. Often, it is intuitive shorthand for the mathematics. R’s interactive nature and the ability to get near instantaneous feedback encourages experimentation and self-learning; and, once you get a feel for where the resources can be found, the commitment and creativity of the R community is a source of great encouragement.

It is true that learning R takes some effort. However, just like with learning a new natural language useful things can be done and great fun had before achieving fluency. I think that the process of learning R can be broken down into the following five stages:

1. Understand something of the culture of the R community, the environment in which the R programming language is maintained and developed. Become familiar with the resources available. Install the R on your computer and run a test script.

2. Read csv files into data frames and confidently use R functions to perform statistical analyses in a domain with which you are familiar.

3. Use the basic control structures of the R language to write simple programs. Write your own functions, become familiar with the data structures included in R and begin to explore the rich features of the language. Interface with database, web pages and other external data sources.

4. Write complex programs in the language. Develop an understanding of the deep structure of the language S3 and S4 objects, closures etc.

5. Develop programs for production use. Write an R package.

Stage 1 can be achieved in less than a day and, with the right reference book, should be enough to launch anyone sitting down to learn statistics on a very good trajectory. The completion of stage 2 with regular work at stage 3 might be all that most people ever need to know. Once one becomes familiar with the libraries of R functions that are important to one’s field, it is not inconceivable that proficiency at this level is sufficient for professional scientists, social scientists and others for whom the mechanics of model building and analysis is not their main focus can go about their daily work. For the rest of us who want to do some serious modeling analysis, it’s a matter of taking Malcolm Gladwell’s advice and getting in your 10,000 hours.

So, how would I advise an R newbie to go about learning R? – jump right in, get oriented, latch on to a learning resource that fits your style, run other people’s R scripts that do something interesting, and begin writing your own.

Getting oriented

The best way to get oriented is to explore theInside-R web site,CRAN (particularly the task views) and crantastic. Download R and a GUI-based integrated development environment (IDE). If you are fortunate enough to have access to Revolution Analytics Enterprise R IDEthen you are off to a very good start. Otherwise, try RStudio.

Resources

Resources for learning R generally fit into three categories:
1. Books, papers, presentations and other “slideware”
2. Blogs
3. Formal courses

Books

I am a book person, so my knee jerk reaction to learning anything new is to find a good book. This might seem quaint to the mobile app generation, but, as it turns out, each of the major technical publishing houses specializing in statistics books: Springer, the Cambridge University Press, Chapman&Hall / CRC have excellent books on doing statistics with R. Springer is the clear leader. The short texts in Springer’s Use-R series are at an introductory level, are modestly priced and each focuses on a different statistical area. The following recommendations are only just a small sample of what is available. Even the extensive list on the Inside-R site is no longer complete.
Probably the best text for someone new to both statistics and R is Peter Dalgaar’s “Introductory Statistics with R” . A personal favorite of mine at approximately the same level is John Fox’s “An R and S-Plus Companion to Applied Regression” . Slightly more advanced but very readable and enjoyable texts are Maindonald and Braun’s “Data Analysis and Graphics Using R: An Example-based Approach” and Gelman and Hill’s "Data Analysis Using Regression and Multilevel / Hierarchical Models”. A reference text that every aspiring R competent statistician ought to have is Venables and Ripley’s “Modern Applied Statistics with S (Statistics and Computing”.

A very short but sweet book that ought to help beginners become familiar with R’s data structures is Phil Spector’s “Data Manipulation with R”. Two other noteworthy books in this class are the O’Reilly publications “R in a Nutshell” by Joe Adler and the “R Cookbook” by Paul Teetor. If you have a SAS or SPSS background then Robert Muenchen’s “R for SAS and SPSS Users” might be your bible. If you are an accomplished programmer and want a technical overview of the R language try John Chamber’s “Software for Data Analysis" .

Blogs

Besides books and their accompanying websites blogs are excellent place to get your hands on interesting, useful code. My favorite blogs are David Smith’s blog at Revolution, Quick R, R-Bloggers , and Rob Hyndman’s blog.

Courses

If a semi-formal setting better suites you style of learning than please do have a look at the courses offered by Statistics.com. I took one of their courses taught by Hadley Wickham, and very much enjoyed it.

Comments

Anonymous's picture

I particularly liked your characterisation of the phases of learning R and the careful selection of book recommendations. There are so many resources these days that the real challenge is helping new R users filter through what is available. You inspired me to update my own guide on getting started with R.

Anonymous's picture

Thank you. It is kind of you to say that. Good luck with R!

Geraldfine's picture

I am appreciating it very much! Looking forward to another great blog. Good luck to the author! all the best best bad credit loan

Anonymous's picture

Thank you for an excellent guide. Very concise and instructive.

Jackieander's picture

Thanks blog is listed in my top favorite blogs which i like most and i visit regularly.
work at home jobs

fedilnasan's picture

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have Bookmarked it and I am looking forward to reading new articles.Keep up the good work! personal loans with bad credit

Anonymous's picture

Joe, Like you, I'm a book person. Our short lists are nearly identical. One nit, you may want to update link to John Fox's book to http://www.amazon.com/R-Companion-Applied-Regression/dp/141297514X/ref=s...

The 2nd edition that he jointly wrote with Sandy Weisberg totally up to date & greatly expanded.
-Jim

Anonymous's picture

Good catch. Thank you. The link has been updated.

Anonymous's picture

R best practice == emacs + ess + ( Sweave() + LaTeX | R2wd + MSWord | odfWeave + OpenOffice )

Anonymous's picture

I am finding very useful "A Handbook of Statistical Analyses Using R" second edition by B. Everitt and T. Hothorn. Each chapter has exercises using the package HSAUR2.

R statistics's picture

I have written some basic R tutorials myself.
The tutorials on: R statistics , are just basic tutorials to get to know R. It contains the basics and how working with distributions, frequenties etc can be done in R.

I'm planning on making some more advanced tutorials in the near furture.
But the tutorials that are online right now, make a good base for new R-users.

leveloneluke's picture

Your link for Peter Dalgaard's book is to the version published in 2004. There seems to be a second edition published recently. Any reason for not recommending the newer version? This looks like exactly what I'm looking for.

foredi's picture

Thank you, article is really very nice this can help me think about all of this

bilalmajeed34's picture

I have been teaching a class and we are looking at this subject in the next week. I will be directing my student to look at your post for good information. barriere poker.fr

Dennis's picture

Thanks for informative and helpful post, obviously in your blog everything is good. if you post informative comments on blogs there is always the chance that actual humans will click through.
purchase essay|| cheap essay help ||How To Get Dissertation Help||Dissertation Writing Proposal||Professional Essays Help UK

robandrew514's picture

This is getting a bit more subjective, but I much prefer the Zune Marketplace. The interface is colorful, has more flair, and some cool features like 'Mixview' that let you quickly see related albums, songs, or other users related to what you're listening to. Clicking on one of those will center on that item, and another set of "neighbors" will come into view, allowing you to navigate around exploring by similar artists, songs, or users. Speaking of users, the Zune "Social" is also great fun, letting you find others with shared tastes and becoming friends with them. You then can listen to a playlist created based on an amalgamation of what all your friends are listening to, which is also enjoyable. Those concerned with privacy will be relieved to know you can prevent the public from seeing your personal listening habits if you so choose. Happpy wheels

hannahwillson93's picture

A very good and informative article indeed . It helps me a lot to enhance my knowledge, I really like the way the writer presented his views. I hope to see more informative and useful articles in future.
Cell phone spying

Andrewjohnson's picture

Excellent blog here! Also your site loads up fast! What web host are you using? Can I get your affiliate link to your host? I wish my website loaded up as fast as yours lol

http://www.motorbikegames9.com/

rocky2sdat's picture

What a fantastic post ! it was absolutely actual informative.I attending advanced in account added of your assignment post, And accomplish you abiding that i will bookmark your post how ever i can appear a back latter.

drain cleaning Los Angeles

kalaircs90's picture

Wonderful subject and fair ... you simply have to do more study to come to be many more specific. Yet it's not that bad, it's amazing

kalaircs90's picture

Wonderful subject and fair ... you simply have to do more study to come to be many more specific. Yet it's not that bad, it's amazing.
Small Business Directory

rocky2sdat's picture

This is simply the qualified data I am identifying everywhere.Me and my companion were contending concerning an issue comparative to this! Notwithstanding I know that I was right.Thanks for the informative content you present. I actually subscribe your website. This is an excellent web journal.
Bailbonds Fort Worth TX

greenvalley30's picture

This is exactly what I was looking for. Thanks for sharing this great article! That is very interesting Smile I love reading and I am always searching for informative information like this! - alat tes darah

cherylbennett's picture

Nice blog, I am really interested in these kind of posts as they motivate me to learn online. buy instagram followers

bilalmajeed34's picture

I would like to appreciate your hard work you did write this post, Thanks for sharing this valuable post.
ristrutturazione appartamento roma

bilalmajeed34's picture

I have been teaching a class and we are looking at this subject in the next week. I will be directing my student to look at your post for good information.
enhancement

patrickm.michael's picture

Thank you for sharing!Very much like we left a deep impression, and will always come....
cenaless

bilalmajeed34's picture

I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one
buy instagram followers

bilalmajeed34's picture

I would like to appreciate your hard work you did write this post, Thanks for sharing this valuable post.
how to start a website

bilalmajeed34's picture

I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one.
buying youtube views cheap

bilalmajeed34's picture

Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial. Appreciate your sharing.
oster toaster oven 6057

bilalmajeed34's picture

I’m glad Yahoo pointed me to it. I was able to get the know-how I was searching so badly for days now.Thank You very much for your really good web page. Have a good day.It's very useful for everyone for sure.
teeth whitening at home

bilalmajeed34's picture

Our posting should be related to the topic "Do you have any other posts about this topic?"
buy Instagram followers and likes

bilalmajeed34's picture

I am in the middle of working on a school report on this topic and your post has helped me with the information I needed to complete it. Thanks
3d rendering

bilalmajeed34's picture

I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one
buy tickets online

bilalmajeed34's picture

I really do not truly have much to say in response, I only wanted to comment to reply great work.
web design west palm beach

waltondana's picture

I always prefer to read the quality content and this thing I found in you post. Thanks for sharing...

bravo2's picture

Very good position. I am only the plentiful visitor having happened to discover you and think of doctrine's words Super Bowl 2013

bilalmajeed34's picture

Our posting should be related to the topic "Do you have any other posts about this topic?"
Mixing online

bravo2's picture

This non-partisan set of common sense proposals offered solutions that would appeal to both the political left and the political right, by focusing on issues such as ending wasteful subsidies, cutting unnecessary military spending, and enacting entitlement reform. epad tablet

william2johns's picture

There is a lot of confusion about business letters and many people are not sure exactly what a "business letter" really is. In fact, the term "online technical writing" is a very general one that can mean many different specific letter types. This article clears up the confusion.

bilalmajeed34's picture

Wow. This blog is truly a gold mine. I have been wallowing on this for quite sometime and here I am reading about it! I will actually try these tips and let you know how they work out! Thanks again mate.
MSA 10107602

bravo2's picture

The writing style is great and the content is top-notch. Thanks for the insight you provide the readers! United Appliance Inc

valentinajames41's picture

Wonderful post!This is very useful to many readers like me. Well, I appreciate your efforts in creating this post however I believe you should take the time and Thank you for the great article I did enjoyed reading it, I will be sure to bookmark your blog.
TextMessages Spy

andersonjude's picture

Your posting is great, and using content is very easy to understand...
derm pure

bravo2's picture

This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. dock solar lights

jennystellla's picture

Happy to see your blog, It content useful information for me......

mylest.griffin's picture

often prefer to read through the standard material and this issue I found in you post. Thanks for sharing...

website

bravo2's picture

I understand everyone got their own opinion, but really? Listen, your web log is cool. I like the efforts you put into it. Commonwealth Life

bilalmajeed34's picture

OASIS is a massive virtual galaxy where your avatar can be anything you want it to be, it's a place where you can live, play, quest on any of the thousands of planets.
buy cheap kamagra