DEV Community

Raman Butta
Raman Butta

Posted on

Installing R in Ubuntu 22.04 LTS

Step 1 : Install R-Base

Go to the terminal and run:

sudo apt update
sudo apt install r-base
Enter fullscreen mode Exit fullscreen mode

This is equivalent to installing R or R-GUI on Windows. With this you can run R in the terminal and get an interactive console to run R commands even without an IDE. But we'll install an IDE called R-Studio in the next step anyway.

Step 2 : Install R-Studio

Go to the site posit.co and download the latest .deb file for Ubuntu 22. Then run sudo dpkg -i filename.deb in the terminal to install it. While installing you may get certain dependency errors. Install those dependencies and run commands as prompted in the error log. And then run the sudo dpkg -i command again. And just like that, you will have installed R Studio.

Now simply run rstudio & in the terminal and the IDE will open. You may get some GPU errors in the terminal which you can ignore as R Studio auto-detects the hardware GPU in your system and in absence of
that, runs on a software GPU, so your IDE will work without issues.

Now you can run R scripts in the editor, interact in the console, look at variables and plots just like the Spyder IDE for python, and install packages from within the IDE.

Top comments (0)