R

R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R.

R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, …) and graphical techniques, and is highly extensible. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity.

One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.

R is available as Free Software under the terms of the Free Software Foundation’s GNU General Public License in source code form. It compiles and runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), Windows and MacOS.

R installation#

Usually it should be pre-installed as part of our default Ubuntu image. Otherwise you may install it from repository:

sudo apt install r-base

If you find the version outdated (old-stable), there is an option to add CRAN repo into Ubuntu distribution. Please refer to official documentation (a bit fragmened and inconsistent so just run the following commands for the desired effect):

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
sudo apt update
sudo apt install r-base

R libraries and modules installation#

There are many packages included in standard repository (usually prefixed with r-). On the other hand, if the package is not included there or outdated, or available as source only at CRAN, you might install it directly from R like e.g.:

install.packages('txtplot')

R IDE#

One of the most popular is RStudio now. They’ve moved to Posit recently, so historical links to ‘rstudio.com’ might be broken.

Usually RStudio should be installed already on your desktop, however you can download it here : for Ubuntu scroll down to Ubuntu 18+/Debian 10+, download DEB package, then install it with sudo dpkg -i rstudio-[version-number]-amd64.deb