Installing R and RStudio Desktop in Ubuntu Linux

We ever discussed How To Install R and RStudio Server in Ubuntu Linux 20.04. If the purpose is to install a local RStudio IDE instead of a remote RStudio Server, we can install RStudio Desktop.

In this post, we introduce how to install R and RStudio Desktop on Ubuntu Linux 20.04. For other Ubuntu version, the steps are similar. But make sure to download the RStudio Desktop package for that version of Ubuntu Linux.

Install R environment

Install R environment as follows (for more details, please check Install R environment in Ubuntu Linux) as follows.

$ sudo apt update
$ sudo apt install r-base

Install RStudio Desktop on Ubuntu

After the R environment is ready, we can move to to install the RStudio Desktop.

First, download the RStudio Desktop software package by (here, we use version 1.3.1093 as an example, you need to find the link for the specific version you want to install and use that link in the command line below)

$ wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.3.1093-amd64.deb

Then, install the deb package as follows (again, we use the 1.3.1092 as the example. If you are using a different version, change the command to match the file name you downloaded in the previous step).

$ sudo apt install ./rstudio-1.3.1093-amd64.deb 

It should print output as follows.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'rstudio' instead of './rstudio-1.3.1093-amd64.deb'
The following NEW packages will be installed:
  rstudio
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/127 MB of archives.
After this operation, 844 MB of additional disk space will be used.
Get:1 /home/davidyang/Downloads/rstudio-1.3.1093-amd64.deb rstudio amd64 1.3.1093 [127 MB]
Selecting previously unselected package rstudio.
(Reading database ... 267829 files and directories currently installed.)
Preparing to unpack .../rstudio-1.3.1093-amd64.deb ...
Unpacking rstudio (1.3.1093) ...
Setting up rstudio (1.3.1093) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for shared-mime-info (1.15-1) ...

Verify the R and RStudio Desktop installation

Start RStudio Desktop by opening the RStudio program from the application launcher or application menu, or by running the command

$ rstudio

Then the RStudio Desktop window will show. In the Console panel, let’s run some demos and verify the environment:

> demo(nlm)

Hit Enter to start the demos. The results and plot will shows as follows.

5 comments:

  1. After “Note, selecting ‘rstudio’ instead of ‘./rstudio-1.3.1093-amd64.deb'”
    I get error message
    “Some packages could not be installed. . . .
    The following packages have unmet dependencies:
    rstudio : Depends: libclang-dev but it is not going to be installed”
    Tried
    % sudo apt-get install libclang-dev
    and got error message
    libclang-dev : Depends: libclang-10-dev but it is not going to be installed”
    ==============
    I’m looking for a solution or an alternative; will share what I find.

      1. 1.3.1093 is an example. For different versions, the corresponding link should be used. The method is the same. We added a note about this in the post.

Leave a Reply

Your email address will not be published. Required fields are marked *