1. Download the latest version of R, for Windows, from CRAN at : https://cran.r-project.org/bin/windows/base/
2. Double-click on the file you just downloaded to install R
3. Click ok -> Next -> Next -> Next … (no need to change default installation parameters)
To install the complete R system, use
sudo apt-get update
sudo apt-get install r-base
Users who need to compile R packages from source [e.g. package maintainers, or anyone installing packages with install.packages()] should also install the r-base-dev package:
sudo apt-get install r-base-dev
The R packages for Ubuntu otherwise behave like the Debian ones. One may find additional information in the Debian README file located at https://cran.R-project.org/bin/linux/debian/.
Installation and compilation of R or some of its packages may require Ubuntu packages from the “backports” repositories. Therefore, it is suggested to activate the backports repositories with an entry like
deb https://<my.favorite.ubuntu.mirror>/ bionic-backports main restricted universe
in your /etc/apt/sources.list file. See https://launchpad.net/ubuntu/+archivemirrors for the list of Ubuntu mirrors.
A number of R packages are available from the Ubuntu repositories with names starting with r-cran-. The following ones are kept up-to-date on CRAN: all packages part of the r-recommended bundle, namely
as well as
The other r-cran-* packages are updated with Ubuntu releases only. Users who need to update one of these R packages (say r-cran-foo) should first make sure to obtain all the required build dependencies with
sudo apt-get build-dep r-cran-foo
The R packages part of the Ubuntu r-base and r-recommended packages are installed into the directory /usr/lib/R/library. These can be updated using apt-get with
sudo apt-get update
sudo apt-get upgrade
The other r-cran-* packages shipped with Ubuntu are installed into the directory /usr/lib/R/site-library.
Installing R packages not provided with Ubuntu first requires tools to compile the packages from source. These tools are installed via the R development package with
sudo apt-get install r-base-dev
Then a site administrator can install R packages into the directory /usr/local/lib/R/site-library by running R as root and using the
> install.packages()
function. A routine update can then be undertaken from R using
> update.packages(lib.loc = "/usr/local/lib/R/site-library")
The paths above are stored in the R_LIBS_SITE environment variable defined in the /etc/R/Renviron file.
Individual users can install R packages into their home directory. The simplest procedure is to create a file ~/.Renviron containing, e.g.,
R_LIBS_USER="~/lib/R/library"
The install.packages() and update.packages() functions will then work in directory ~/lib/R/library. It is also possible to automatically create version-specific library trees; see ?.libPaths in R for more information.
1. Download RStudio at : https://www.rstudio.com/products/rstudio/download/
2. Open and run the file you just downloaded RStudio-version_xxxxx.exe
3. You don’t have to change any of the defaults for the installation