Ubuntu – Installing RStudio — is this very different from other packages?

aptjavapparstudio

I see these instructions to install RStudio:

https://www.datascienceriot.com/33/kris/

But I'm a little gun-shy to trust them because they seem more substantial than the usual method of adding a PPA and then installing. Also, I just wiped my computer clean and did a fresh install of Ubuntu because things stopped working right and I think it was because of an improper install of either Java's JDK or RStudio, or both, or something else. So I want to be sure I'm doing the right thing.

So my questions are: Should I follow these instructions or should I be doing something else? And why can you not just add a PPA like I did for installing, say, Atom?

I'm running Ubuntu 17.04 and would rather not directly download a .deb file because, as I understand it, this would not automatically update when updates are released.

Best Answer

There are two components to get RStudio to work

First, get R from PPA

You can get R from the repositories, but it likely won't be the latest version. I use Michael Rutter's PPA. The following commands will get the latest version of R installed:

sudo add-apt-repository ppa:marutter/rrutter
sudo apt-get update
sudo apt-get install r-base r-base-dev

Second, install RStudio

Unfortunately, the makers of RStudio do not make their software available via a PPA or in the Ubuntu repository. You have to install it from the deb file which is available on their website.

  1. Go to https://www.rstudio.com/products/rstudio/#Desktop
  2. Click on DOWNLOAD RSTUDIO DESKTOP button.
  3. Look for "RStudio Desktop Open Source License" and click the DOWNLOAD button below it.
  4. Look under the "Installer for supported platform" and find that says: "RStudio x.y.zzz - Ubuntu 12.04+/Debian 8+ (64-bit)", assuming you are using 64 bit Ubuntu and click on it. This will download the `deb' file. Wait for the download to complete.
  5. Open the file browser and double click on the Deb file to open it in the Software Center.
  6. Install using software center.

If you run into libgstreamer dependency issues see Install the lastest version of RStudio

You are right, the deb file will not update itself and revisiting the RStudio every now and then to see there are updates is tedious. Inside RStudio Menu > Help > Check for Updates eases the pain somewhat. If you click on this RStudio will check for updates of itself and give you the option to close RStudio and download the new deb file. This will close RStudio and open your default web browser and take you to the RStudio download page in step 3 above.

You can get RStudio to automatically check for updates in Menu > Tools > Global Options...> General Tab> Automatically notify me of updates to RStudio check box.

Bonus Point

As you use R, you will need to install other R packages. Sometimes these are available in the repositories. Say the r package you want it foo then the package in the repositories is called r-cran-foo.

sudo apt-get r-cran-foo

will get the job done. This is the best option as it will keep foo updated. However, this does not always work.

If this does not work you will want to install and/or update R packages from inside RStudio. If you do this, you will find that RStudio would put the new files (including updates) inside in your home directory /home/<user>/R/.

One way to solve this problem and let RStudio install additional packages in its proper place is to add yourself to the group staff by using the following command in the Ubuntu terminal:

sudo adduser <user> staff

Replace <user> with your username.

After this, you will get the option of installing or updating packages /usr/local/lib/R/ or in /home/<user>/R/. Then you will be able to choose the former as the default install location.

Source: https://stackoverflow.com/questions/5560139/install-r-package-xml-in-debian-ubuntu

Hope this helps

Related Question