How to change RStudio version on Ubuntu?

Hello!

I want to change my RStudio version to R 3.4.1 - packages used in one of the scripts don't work with the newest version (eg. "eurostat"). I have a prepared folder with RStudio version and on Windows I just go to Tools -> Global Options and change the RStudio version to the folder. On Ubuntu this option is missing!

How can I handle this issue? I'm not a computer expert, I've already tried going through this tutorial: https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop . I typed the command

export RSTUDIO_WHICH_R=/usr/local/bin/R

where I exchanged /usr/local/bin/R for a path to the folder with another RStudio version. Nothing has changed. What should I do?

1 Like

Your are mixing things up, R and Rstudio are two independent pieces of software, if you want a different R version, then you have to install it on your system.

1 Like

I haven't tried this exact procedure on a VM or anything, so be aware of that. Hopefully this also fixes the mucking about with /usr/local/bin/R alluded to in the question. Using the command line I'd attempt the following:

Show available versions provided by the r-base package

apt-cache showpkg r-base

This emits a bunch of text to your console. The important bit should be at the end about versions provided. You'll need to choose one of those. For me the only 3.4 listed is 3.4.4-1ubuntu1. Write that down or copy-pasta it somewhere.

Purge existing R package

Unless you want to attempt to manage two R installs on the same system, I'd blow away the existing R installation.

sudo apt-cache purge r-base

Then clean up any packages that are no longer needed

sudo apt-get autoremove

Install package of specified version

Heat up that copy-pasta we made earlier and stuff that into the package version specification for apt-get

sudo apt-get install r-base=3.4.4-1ubuntu1

Mark the package to not be upgraded

sudo apt-mark hold r-base

I managed to change my R version to 3.4.1, but it doesn't seem to solve the issue. Still, the packages used in my R script don't work and after installing them I see this warning:

Warning in install.packages :
installation of package ‘eurostat’ had non-zero exit status

I tried googling the error and found out that it's a problem connected to the package. What I am looking for is something that would do exactly the same as "Change R version" in "Global settings" on Windows. Seems the folder with R 3.4.1 provided with the script contains some files that makes the package usable.

installation of package ‘eurostat’ had non-zero exit status

Is telling you that the installation of that package failed. Likely there is a dependency missing. What is the output of running install.packages("eurostat") ? It may contain a message or clue about what is needed to remedy the situation.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.