R is a powerful open-source programming language used widely for data analysis and statistical computing. With its growing popularity, many users want to install R on their Ubuntu systems to start using it for their data analysis needs.
If you’re new to R or to installing software on Ubuntu, this step-by-step guide will help you install R on your Ubuntu systems.
Installing R on Ubuntu
You can install R programming language on Ubuntu with a few steps below:
- First update the indices on your system
sudo apt update
- Now install the following helper packagers
sudo apt install --no-install-recommends software-properties-common dirmngr
- Add the GPG key to your system
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
- Next configure the PPA on the ubuntu system.
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
Here we use
`lsb_release -cs`
to access which Ubuntu flavor you run: one of “jammy”, impish”, “focal”, “bionic”, … - Finally, install the R programming language with the following command.
Then runsudo apt install --no-install-recommends r-base
This installs the R packages and dependencies on your system.
- Once the installation is finished, check the R version:
R --version
This will display the version of R that you have installed. You should have R version 4.0.3 or higher.
Adding PPA for 5000+ CRAN Packages
The c2d4u contains 5000+ CRAN packages for the installation th Run this command (as root or by prefixing sudo) to add the current R 4.0 or later ‘c2d4u’ repository:
sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+
The ‘c2d4u’ repository is only available for LTS releases.
Conclusion
That’s it! You have now successfully installed R on your Ubuntu system. You can start using R for data analysis and statistical computing right away.
I hope this step-by-step guide has been helpful in installing R on your Ubuntu system.