
{{ $('Map tags to IDs').item.json.title }}
Installing R and RStudio on Ubuntu
R is a programming language and free software environment used for statistical computing and graphics. RStudio is an integrated development environment (IDE) for R that makes it easier to work with R. This tutorial will guide you through the installation of both R and RStudio on Ubuntu.
Prerequisites
- A system running Ubuntu (preferably 20.04 or later).
- Root or sudo privileges to install software.
- Basic knowledge of using the terminal.
1. Installing R
R can be installed from the official CRAN repository. First, you need to add the CRAN repository to your system:
sudo apt update
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:marutter/rrutter4.0
Next, import the public key for the repository:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
Now, update your package index again and install R:
sudo apt update
sudo apt install r-base -y
2. Verifying the Installation
After the installation is complete, you can verify if R is installed correctly by running:
R --version
This command should display the installed version of R.
3. Installing RStudio
RStudio can be installed by downloading the latest .deb package from the RStudio website. Check the latest version:
wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-2022.07.2-580-amd64.deb
Install the downloaded package using:
sudo dpkg -i rstudio-2022.07.2-580-amd64.deb
If there are any missing dependencies, run:
sudo apt --fix-broken install
4. Launching RStudio
After installing RStudio, you can start it from your application menu or run the following command in the terminal:
rstudio
5. Installing Additional R Packages
To enhance your R environment, you might want to install additional packages. Open RStudio and use the following command to install packages from CRAN:
install.packages('ggplot2')
Replace ggplot2
with the name of any package you wish to install.
6. Conclusion
You have successfully installed R and RStudio on your Ubuntu system. With this powerful combination, you can carry out statistical analysis, data visualization, and more. Explore the vast array of libraries available in R to expand your capabilities in data science and analysis.