Installing RStudio -- is this very different from other packages?

13,463

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

Share:
13,463

Related videos on Youtube

Addem
Author by

Addem

Updated on September 18, 2022

Comments

  • Addem
    Addem almost 2 years

    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.

  • Addem
    Addem about 7 years
    I'm starting to walk through these steps now, but a question: If you don't have a PPA how do you keep up to date with the latest version of RStudio? Are you constantly checking their website or an RSS feed to see if anything new comes up and manually re-installing?
  • user68186
    user68186 about 7 years
    See my edits to the answer. You can check for updates to RStudio from within RStudio.
  • Addem
    Addem about 7 years
    So when I click "Install" in the Ubuntu Software application it does nothing. I think maybe it's related to the fact that the icon in the folder has a locked symbol on it. That might be there because when it downloaded in Firefox it had the "Open" radio button selected rather than "Save" so I'll go back and re-download the other way and see if that fixes it.
  • Addem
    Addem about 7 years
    Well, turns out I was partially right--by choosing save rather than open the lock symbol goes away but still the software app does not respond when I click Install.
  • user68186
    user68186 about 7 years
    Try closing Software center and any other app that may have opened when you clicked on the "Open" option in Firefox. If GUI methods don't work try sudo dpkg -i packagename.deb.
  • Addem
    Addem about 7 years
    I totally restarted the computer, now it does this weird thing where when I double-click the file and click install, it installs up to 9% and then cancels with no error message. When I use the terminal method it encounters dependency errors. I ran it with gdebi and it couldn't resolve the dependency with libgstreamer0.10-0. I haven't tried to install this directly because there seem to be a lot of options, even developer options, so I'm not sure which I should pick.