R is a powerful and open source statistical computing and graphical language and environment. The goal of this tutorial is to give a concise introduction to R and is aimed at Civil and Environmental Engineering undergraduate and graduate students. This tutorial is by no means comprehensive. There are several very good detailed sources for R. Some of the popular R books are:

There are also several free resources available. I highly recommend reading the ``Introduction to R’’ pdf document which comes with the R installation. There are also several youtube videos and courses on MOOCs on using R for data analysis.


If the figures in this tutorial appear too small or too big, try a different browser. If the formatting appears odd on multiple browsers, send me an email and I will do my best to fix the issue.

Installing R and R Studio

This section provides instructions for installing R as well as RStudio.

Installing R

  • Go to the webpage: http://cran.cnr.berkeley.edu/
  • There are three links on the webpage:
    • Download R for Linux
    • Download R for MacOSX
    • Download R for Windows.
  • The rest of the instructions assume that you have a windows operating system
  • Click on Download R for Windows link.
  • You will reach R for windows webpage. Click on ``install R for the first time’’ link
  • In the next page click on Download R 3.1.3 for Windows link. Note that 3.1.3 corresponds to the R version number. This will get updated frequently as the software is being developed.
  • Save the ``R-3.1.3-win.exe’’ file to any directory on your computer
  • Double click the file to start the installation and use the default settings for all installation related settings.
  • The Setup Language is English. Choose default options for the rest of the installation steps.
  • At the end of the installation you should see an icon with a big R on your desktop. If you have a 64 bit operation system you will see two icons as shown below: