A little demo of programming in


Marie-Hélène Burle

February 15, 2024

A few words about R


Created by academic statisticians Ross Ihaka and Robert Gentleman

The name comes from the language S which was a great influence as well as the first initial of the developers

Launched in 1993

A GNU Project since 1997

Why R?

Free and open source

High-level and easy to learn

Large community

Very well documented

Unequalled number of statistics and modelling packages

Integrated package manager

Easy connection with fast compiled languages such as C and C++

Powerful IDEs (e.g. RStudio, ESS, Jupyter)

For whom?

Fields with heavy statistics, modelling, or Bayesian inference such as biology, linguistics, economics, or statistics

Data science


Inconsistent syntax full of quirks


Large memory usage

Running R

An interpreted language

R being an interpreted language, it can be run non-interactively or interactively

Running R non-interactively

If you write code in a text file (called a script), you can then execute it with:

Rscript my_script.R

The command to execute scripts is Rscript rather than R
By convention, R scripts take the extension .R

Running R interactively

There are several ways to run R interactively:

  • directly in the console (the name for the R shell)
  • in Jupyter with the R kernel (IRkernel package)
  • in another IDE (e.g. in Emacs with ESS)
  • in the RStudio IDE

The R console



Posit (formerly RStudio Inc.) developed a great and very popular IDE called RStudio

Here is its cheatsheet (click on it to download it):