R

A free software environment for statistical computing and graphics.

Installed packages:

  • r-base → Core R environment (interpreter, standard libraries, docs).
  • r-base-dev → Development tools to build and compile R packages from source. Includes compilers, headers, and common build dependencies.

Repository maintained by Michael Rutter.

Starting R

Start an interactive session:

R

Exit with:

q()

Important Files & Directories

  • Binaries: /usr/bin/R
  • Core libraries: /usr/lib/R
  • User site-library (packages): /usr/local/lib/R/site-library
  • Configurations: /etc/R (system-wide configs like Rprofile.site, Renviron)

Installing Packages

From Ubuntu repositories (system-wide):

sudo apt install r-cran-ggplot2

From R console (latest from CRAN):

install.packages("ggplot2")

Verification

Check installed version:

R --version

List installed packages in R:

installed.packages()

Use a Dedicated Non-Root User (Recommended)

For better security and to prevent accidental system changes, you should create and use a non-root user for development.

Run the following commands to create a new user (e.g., user) and set their password (replace user with your preferred username):

useradd -m -s /bin/bash user
passwd user

(Optional) Add user to sudo group:

usermod -aG sudo user

Switch to the new user:

su - user

Currently unavailable.

Application Details