TIDE
Languages

R

Installing R on Ubuntu in TIDE

R

R is a programming language and free software environment for statistical computing, data visualization, bioinformatics, and data science. Maintained by the R Foundation, it offers extensive package repositories (CRAN) for advanced data manipulation and machine learning.

Installation

You can install R using standard Ubuntu packages or configure the official CRAN repository to ensure access to the latest R release.

Using Standard APT

apt update
apt install -y r-base r-base-dev

Using Official CRAN Repository (Latest Release)

To install the latest R 4.x binaries from CRAN:

apt update
apt install -y software-properties-common dirmngr wget
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor -o /usr/share/keyrings/cran-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/cran-archive-keyring.gpg] https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" > /etc/apt/sources.list.d/cran.list
apt update
apt install -y r-base r-base-dev

Verification

Check the installed R version:

Rscript --version

Writing and Running Code

Create an R script file named hello.R:

cat("Hello from R in TIDE!\n")

Running the Script

Execute the script non-interactively using Rscript:

Rscript hello.R

Interactive R Console

Start the interactive R console:

R

To quit the interactive R session, type q() and press Enter.

Installing CRAN Packages

Inside the interactive R console or script, install packages using install.packages():

install.packages("ggplot2")

Official Resources

On this page