CME/STATS 195 Introduction to R

Logo

Stanford introductory course on programming in R.

Home

Material

Assignments

Installation

Resources

Software Installation

In order to work with R you will need to complete two following tasks:

The editor can independent of R, and can be usually used to write code in other languages. You can even use a basic text editor to write an R script, but this of course is sub-optimal.

The two option frequently used by R programmers are RStudio IDE and Emacs (for intermediate/advanced users).

You are free to pick an editor that you feel most comfortable with. However, all instructions and lecture materials will use Rstudio.

Installing R

Installing RStudio

Install the latest version of RStudio. RStudio includes many cool features including interactive R Notebooks, and an integrated terminal window.

Running R

The interpreter mode

To start the R console you can either

To open a terminal window use:

Then, you can interactively give instructions to the computer, using the R commands. To quit enter q().

The R console is also available as one of the panes in the RStudio IDE, and is automatically started when you launch RStudio.

The scripting mode

R markdown / R Notebook

You can find more on R Notebooks here.

back