Learn everything about Analytics

Home Learning paths – Data Science, Business Analytics, Business Intelligence and Big Data LeaRning Path on R – Step by Step Guide to Learn Data Science on R

LeaRning Path on R – Step by Step Guide to Learn Data Science on R

One of the common problems people face in learning R is lack of a structured path. They don’t know, from where to start, how to proceed, which track to choose? Though, there is an overload of good free resources available on the Internet, this could be overwhelming as well as confusing at the same time.

To create this R learning path, Analytics Vidhya and DataCamp sat together and selected a comprehensive set of resources to help you learn R from scratch. This learning path is a great introduction for anyone new to data science or R, and if you are a more experienced R user you will be updated on some of the latest advancements.

This will help you learn R quickly and efficiently. Time to have fun while lea-R-ning!


Step 0: Warming up

Before starting your journey, the first question to answer is: Why use R? or How would R be useful?

R is a fast growing open source contestant to commercial software packages like SAS, STATA and SPSS. The demand for R skills in the job marketing is rising rapidly, and recently companies such as Microsoft pledged their commitment to R as a lingua franca of Data Science.

Watch this 90 seconds video from Revolution Analytics to get an idea of how useful R could be. Incidentally Revolution Analytics just got acquired by Microsoft.


Step 1: Setting up your machine

The easiest way to set-up R is by downloading a copy of it on your local computer from the Comprehensive R Archive Network (CRAN). You can choose between binaries for Linux, Mac and Windows.

Although you could consider working with the basic R console, we recommend you to install one of R’s integrated development environment (IDE). The most well known IDE is RStudio, which makes R coding much easier and faster as it allows you to type multiple lines of code, handle plots, install and maintain packages and navigate your programming environment much more productively. An alternative to RStudio is Architect, an eclipse-based workbench.

(Need a GUI? Check R-commander or Deducer)


  1. Install R, and RStudio
  2. Install Packages Rcmdr, rattle, and Deducer. Install all suggested packages or dependencies including GUI.
  3. Load these packages using library command and open these GUIs one by one.


Step 2: Learn the basics of R  language

You should start by understanding the basics of the language, libraries and data structure.Learn R Programming, Data Handling & More

If you prefer an online interactive learning environment to learn R’s syntax this free online R tutorial by DataCamp is a great way to get you going. Also check the successor to this course: intermediate R programming. An alternative learning tool is this online version of swirl where you can learn R in an environment similar to RStudio.

Next to these interactive learning environments, you can also choose to enroll in one of the Moocs available on Coursera or Edx.  

In addition to these online resources, you can also consider the following excellent written resources:

Specifically learn: read.table, data frames, table, summary, describe, loading and installing packages, data visualization using plot command


  1. Take the free online R tutorial by DataCamp and become familiar with basic R syntax
  2. Create a github account at http://github.com
  3. Learn to troubleshoot package installation above by googling for help.
  4. Install package swirl and learn R programming (see above)


Step 3: Understanding the R community

4The major reason R is growing rapidly and is such a huge success, is because of its strong community. At the center of this is R’s package ecosystem. These packages can be downloaded from the Comprehensive R Archive Network, or from bioconductor, github and bitbucket. At Rdocumentation you can easily search packages from CRAN, github and bioconductor that will fit your needs for the task at hand.

Next to the package ecosystem R, you can also easily find help and feedback on your R endeavours. First of all there is R’s built-in help system which you can access via the command ? and the name of e.g. a function. There is also Analytics Vidhya Discussions,  Stack Overflow where R is one of the fastests growing languages. To end, there are numerous blogs run by R enthusiast, a great collection of these is aggregated at R-bloggers.



Step 4: Importing and manipulating your data

Importing and manipulating your data are important steps in the data science workflow. R allows for the import of different data formats using specific packages that can make your job easier:

  • readr for importing flat files
  • The readxl package for getting excel files into R
  • The haven package lets you import SAS, STATA and SPSS data files into R.
  • Databases: connect via packages like RMySQL and RpostgreSQL, and access and manipulate via DBI
  • rvest for webscraping

Once your data is available in your working environment you are ready to start manipulating it using these packages:



Step 5: Effective Data Visualization

There is no greater satisfaction than creating your own data visualizations. However, visualizing data is as much of an art as it is a skill. A great read on this is Edward Tufte principles for visualizing quantitative data, or the pitfalls on dashboard design by Stephen Few. Also check out the blog FlowingData by Nathan Yau for inspiration on creating visualization using (mainly) R.

5.1: Plots everywhere

R offers multiple ways for creating graphs. The standard way is by making use of base graphics in R. However, there are way better tools (or packages) to create your graphs in a more simple way that will look on top of that way more beautiful:  

  • 3Start with learning the grammar of graphics, a practical way to do data visualizations in R.
  • Probably the most important package to master if you want to become serious about data visualization in R is the ggplot2 package. ggplot2 is so popular that there are tons of resources available on the web for learning purposes such as this online ggplot2 tutorial, a handy cheatsheet or this book by the creator of the package Hadley Wickham.
  • A package such as ggvis allows you create interactive web graphics using the grammar of graphics (see tutorial)
  • Know this ted talk by Hans Rosling? Learn how to re-create this yourself with googleVis (an interface with google charts).
  • In case you run into issues plotting your data this post might help as well.

See more visualization option in this CRAN task view.

Alternatively look at the data visualization guide to R.

5.2: Maps everywhere

Interested in visualizing data on spatial analysis? Take the tutorial on Introduction to visualising spatial data in R and get started easily with these two packages:

  • Visualize spatial data and models on top of static maps from sources such as Google Maps and Open Street Maps with ggmap.
  • Ari Lamstein’s choroplethr
  • The tmap package.



5.3: HTML widgets

A very promising new tool for visualizations in R is the usage of  HTML widgets. HTML widgets allow you to create interactive web visualizations in an easy way (see the tutorial by RStudio) and mastering this type of visualizations is very likely to become a must have R skill. Impress your friends and colleagues with these visualizations:



Step 6: Data Mining and Machine Learning

For those that are new to statistics we recommend these resources:

If you want to sharpen your machine learning skills, consider starting with these tutorials:

Make sure to see the various machine learning options available in R in the relevant CRAN task view.



Step 7: Reporting Results

Communicating your results and sharing your insights with fellow data science enthusiast is equally important as the analysis itself. Luckily R has some very nifty tools to do this that can save you a lot of time.

1The first is R Markdown , a great tool for reporting your data analysis in a reproducible manner based on knitr and pandoc. With R markdown, R generates a final document that replaces the R code with its results. This document can be in an html, word, pfd, ioslides, etc. format. You can learn more on it via this tutorial and use this cheat sheet a a reference.

Next to R Markdown there is also ReporteRs. ReporteRs is an R package for creating Microsoft (Word docx and Powerpoint pptx) and html documents and runs on Windows, Linux, Unix and Mac OS systems. Just like R Markdown it’s an ideal tool to automate reporting generation from R. See here how to get started.

Last but not least there is Shiny, one of the most exciting tools in R around at the moment. Shiny makes it incredibly easy to build interactive web applications with R. It allows you to turn your analysis into interactive web applications without needing to know HTML, CSS or Javascript. If you want to get started with Shiny (and believe us you should!), checkout the RStudio learning portal.


  • Create your first interactive report using RMarkdown and/or ReporteRs
  • Try to build your very first Shiny app


Bonus Step: Practice

You will only become a great R programmer through practice. Therefore, make sure to tackle new data science challenges regularly. The best recommendation we can make to you here is to start competing with fellow data scientists on Kaggle: https://www.kaggle.com/c/titanic-gettingStarted.  

Test your R Skills on live challenges – Practice Problems


Step 8: Time Series Analysis

R has a dedicated task view for Time Series. If you ever want to do something with time series analysis in R, this is definitely the place the start. You will soon see that the scope & depth of tools is tremendous.

You will not run out of online resources for learning time series analysis with R easily. Good starting points are A little book of R for time series or check out Forecasting: principles and practice. In terms of packages, you need to make sure that you are familiar with the zoo package and the xts. Zoo provides you a common used format for saving time series objects, while xts gives you the tools to manipulate your time series data sets.

Alternate resource: Comprehensive tutorial on Time Series


  • Take one of the recommended time series tutorials listed above so you are ready to start your own analysis.
  • Use a package such as  quantmod or quandl to download financial data and start your own time series analysis.
  • Use a package such as  dygraphs to create stunning visualizations of your time series data and analysis.


Bonus Step – Text Mining is Important Too!

To learn text mining, you can refer to text mining module from analytics edge course. Though, the course is archived, you can still access the tutorials.



Step 9: Becoming an R Master

Now that you have learnt most of data analytics using R , it is time to give some advanced topics a shot. There is a good chance that you already know many of these, but have a look at these tutorials too.

You want to apply your analytical skills and test your potential? Then participate in our Hackathons to compete with many Data Scientists from all over the world.


  • dario boriani says:

    Good info. Other resources exist as well, including the courses under the Data Science track at Coursera (offered by JHU.) Disclaimer: I am not affiliated with either.

  • Kathakali Seth says:

    Thanks for providing very useful information. Additionally, would you please provide names of 5 books to learn R from Basic level.

    • Aritra Chatterjee says:

      Start with
      1. R in Action_Robert I Kabacoff
      2. R with Gareth James
      3. Software for Data Analysis by John Chamber

      Above books are good to start with. As you develop skills, you would require multiple books for each topic( Probability Distribution, Regressional Analysis, Time Series, Confidence Interval) in statistics.

  • Ehsan says:

    Very helpful suggestions. Many Thanks 🙂

  • Nithin krishna says:

    Thanks a lot for valuable info.


    Very helpful. As Dario pointed out the R Programming course under the Data Science track at Coursera (offered by JHU) is very helpful too. I already have a verified certificate with them and great improvement in my R knowledge

    • John Mburu says:

      Hello Esther,

      I had started the track but never finished.

      How did it improve you knowledge. I will be interested to know whether it can help me enter data analysis field.


  • Sumit Arora says:

    Very useful indeed. Thank you.

  • Mrinmoy says:

    RCPP/rpy2/pypeR can be used if someone wants to achieve superior performance using some advanced language like c++/python.

  • I follow your blog like Gospel. I would like to complement this learning path with this link

    Its a really good link for understanding data science basics.

  • amran9009 says:

    Hey guys !!!

    Thats a very helpful guide. Thanks a lot.

    Also do check out the course offered by Duke University on Coursera on Data Analysis and Statistics. It covers all the basics of Statistics and also teaches students how to use R for statictics right from the basics. Here is the link : https://www.coursera.org/course/statistics

    Cheers 🙂

  • Vivek Joshi says:

    Valuable article for anyone who wants to become proficient in R. I feel, you can also add Analytics Edge in this learning path. It provides great hands on practice in major analytics algorithms in R.

  • tataoe says:

    I thought I knew a little of R just before I read this post!
    Time to get these done soon!

    Great post! Thanks!

  • Syam says:

    Good job. Nice article to learn R

  • Prateek says:

    Hi Everyone,

    I am doing UCM forecasting for thousands of Products in R. I have the code to do it, the problem is I have to make R read the dataset for all products and then manually read one row at a time and then forecast its sale. I want to automate it so that I put the input file in a folder and then run it so that R starts taking each row one by one automatically and will save the forecasted value in one of the folders on my PC. Do any of you have any reference which I can look to automate my model?

  • mohammad kurdi says:

    Answers a lot of my questions. Thanks for the article.

  • Mitesh Chhabra says:

    Hi Team,

    I have enrolled in PGPBA program from Great Lakes an year later and struggling to complete the course.

    Need your advice what steps i will take to successfull completion.

    My background is core finance and does not have any technical knowledge of tools like R, SAS, VBA, MACRO.
    I have Last installment is pending with Great Lakes.

    Need your advise to help in making my career.

    Kind Regards

  • Jaime Costa Romano says:

    very helpful, thanks al ot ¡¡¡¡

  • Olugbenga says:

    This is the best guide to learning R. Thanks a lot.

  • Sirisha says:

    Thanks a lot for the useful information.

  • rameshkumark.dr@gmail.com says:

    really very useful preparations

  • shivam888sahu@gmail.com says:

    very very useful

  • Pharh says:

    Thank you.

  • MICHAEL says:

    Extremely handy. Thank you.

  • Kumar says:

    Nice Collection!. Like this is there any tutorials available on Experimental Design for Agricultural Researchers and Statistical genetics using R

  • U says:

    For data frame like objects learn the ins and outs of the dplyr package (try this course). that link is dead. plz modify.

  • Anonymous says:

    Superb info, I don’t really comment on blog posts but this one is not just for generating some traffic but truly to help people out there!

  • anil says:

    If anyone can sell openintro statistics by David M Diez at an half price please mail me. I can’t afford for a new book.
    mail id: manil.kumar.met13@itbhu.ac.in

  • RAJKUMAR says:

    i want know about anova in R. so please provide for material with example…(one way anova,two way anova,)


    A suggestion, can you provide article posted date, that way it is easy to validate, its relevance in the market.
    Ex: Revolution Analytics youtube video is dated back in 2013. Lot of things changed, in these years.

Leave A Reply

Your email address will not be published.

Join world’s fastest growing Analytics Community
Receive awesome tips, guides, infographics and become expert at: