Installing older version of R - r

I'm working with R now for some month and I'm still a newbie.
I acutall working for a project to build up R RHadoop and Hadoop.
The sandbox + R + RStudio is already running and working.
I wanted to install R + RStudio also on the bigger cluster with several nodes for testing in cluster mode. But when I installed R, is saw, that a new version comes out, 3.2.2. On my sandbox, I'm still working with 3.2.1.
Version 3.2.2 seems to have some problem with my code, so I want to use 3.2.1, but I'm not able to install older version of R.
How can I install R-3.2.1-2.el6.x86_64 on the cluster as well?
I'm working on centos 6.
Regards,
suerte

I don't know if you found a solution at your problem, but here is how I install old R versions :
0) You should be sure to know which linux version you use
lsb_release -a
You should get something like (this is my result in example):
Distributor ID: Ubuntu
Description: Ubuntu 14.04
Release: 14.04
Codename: trusty
So now I know that my linux is a trusty.
1) After that you need to add a cran repository on your /etc/apt/sources.list
You can find cran address here : https://cran.r-project.org/mirrors.html
That give you access to older package. Choose one for your Linux !!
example :
deb https://cloud.r-project.org/bin/linux/ubuntu trusty/
2) You need to add the registry key to don't have certificate problem. I use this command but fell free to find another one on their website :
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E084DAB9
gpg -a --export E084DAB9 | apt-key add -
3) Here is the tricky part :
1 --> do an apt-get update to have the new repository
2 --> choose your version in the cran and specify it. That should look like something like that :
apt-get -y install r-base-core=3.1.0-1trusty0 #For R
apt-get -y --force-yes install r-doc-html=3.1.0-1trusty0 #For doc
apt-get -y install r-base-dev=3.1.0-1trusty0 # for dev
etc ...
Just be careful, I had some problems when I tried to install r-base=.... and r-recommended= .... All the time, that had install the latest version.
For the cluster I don't know yet but I think a script should work.
Hope that helped.
Regards

Related

Cannot install R - Unable to correct problems, you have held broken packages

We followed instructions here - https://rtask.thinkr.fr/installation-of-r-4-0-on-ubuntu-20-04-lts-and-tips-for-spatial-packages/ - to uninstall R:
sudo apt-get purge r-base* r-recommended r-cran-*
sudo apt autoremove
sudo apt update
...seems to have worked because when we run R in command line we get -bash: /usr/bin/R: No such file or directory. However, when we try to install R using:
apt install --no-install-recommends r-base
...version 3.6.3 is installed, not version 4.0 or 4.1. Here is our machine type.
What can we do to get R version 4.1.0 (preferred) installed on our machine? I am worried that, perhaps it is not possible as if it were, v4 would be the default rather than v3... might it be the case that 16.04 is too old for R v4?
Edit: followed the instructions in the comment below, but ran into the following issue:

Update R base - Ubuntu from 3.4.4 to 3.5.2 - Azure

I'm using Ubuntu 16.04 on Azure Linux Virtual Machine
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
The current R version for Rstudio/Rserver is 3.4.4 and I would like to update it to the latest version (i.e. version 3.5.2)
R --version
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
From some reasons, the most common method doesn't work:
apt-get update
apt-get upgrade
So I did some research and find this post on biostars.org
One of the posts says the following codes might work
sudo su
echo "deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
apt-get update
apt-get install r-base
apt-get install r-base-dev
However, after apt-get install r-base I'm getting the following error message:
root#VMforR:/usr/local/bin# apt-get install r-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
r-base : Depends: r-recommended (= 3.5.2-1xenial) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I don't understand what "held broken packages" means, and more importantly, how to update the R base?
What worked for me was to add the PPA of Michael Rutter:
sudo add-apt-repository ppa:marutter/rrutter3.5
sudo apt-get update
Update R:
sudo apt install r-api-3.5
I'm with the 16.04 LTS ubuntu.
Have tried some other methods, the following seems to work:
sudo apt-get install r-base-core=3.5.2-1xenial
Ref:
1. Install particular version(2.15.2) of r-base on ubuntu
2. https://cran.rstudio.com/bin/linux/ubuntu/xenial-cran35/
But I'm not sure if this also work for others or not, as I can't reproduce it.
After
apt-get update
do
apt-get dist-upgrade
first to "move your installation forward". That includes upgrading already installed packages. It should just upgrade your R installation (unless you also switch / need to switch repositories).
The r-sig-debian list is good and patient with basic 'how do it od X for R on Debian/Ubuntu'. Consider subscribing to lurk and/or ask questions.
Mine said some of my packages were missing. So, I ran sudo dpkg --configure -a and then re-run the R --update and it worked to correct the missing package error.

How to upgrade R in linux?

I am new to Linux. I am using Linux mint 18.1. I have installed R using system software manager. My current R version is 3.2. But I want to upgrade it to version 3.4.
How can I do it?
Note: I now keep on GitHub (here) an up-to-date guide to upgrading R on Linux Mint or Ubuntu Linux, which also includes a bit of extra information about system dependencies for tidyverse, the popular set of data-wrangling packages, as well as devtools, the popular R package development... package.
The link provided by FedRo is a good resource, however a slight change would need to be made since you're using Linux Mint 18.1 which uses Xenial repositories rather than Trusty repositories (see here). I also typically use the approach here to deal with packages I've already installed when I upgrade R rather than the approach offered by FedRo. So, for completeness, these are all the steps you'd need to take:
Step 1
Go to CRAN's list of mirrors and find the URL of the mirror that is closest to you. The terminal commands below assume you choose http://cran.wustl.edu/
Step 2
Open a terminal and enter the following commands1 (replacing http://cran.wustl.edu/ with whichever CRAN mirror URL you chose in step 1):
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt upgrade r-base r-base-dev
sudo apt update
sudo apt upgrade
Note also that I have put to upgrade r-base and r-base-dev, but I don't know if you have r-base-dev installed. If not, I highly recommend you install it via sudo apt install r-base-dev.
Step 3
Start a new R session and run the following:
update.packages(checkBuilt=TRUE, ask=FALSE)
Then you should be good to go.
Update: Linux Mint 19 and R 3.6.x
Since both Linux Mint and R have seen upgrades since I answered this question, I'm updating for those who come to this answer needing the info for Linux Mint 19 and R 3.6.x.
The only difference is that instead of the command
sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
you need to use
sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu bionic-cran35/" | sudo tee -a /etc/apt/sources.list
(replacing http://cran.wustl.edu/ with whichever CRAN mirror URL you chose in step 1)
1 I put here the full key, though many other guides you may see will use only the "short key."
I have updated this guide to use the full key out of security concerns (see here, for example).
Now it is very simple. Just make:
install.packages("ropenblas")
ropenblas::rcompiler()

Install R latest verison on ubuntu 16.04

So I tried to install R (after repairing ubuntu on my system) using following command :
sudo apt-get install r-base-core
sudo apt-get install r-recommended
It installs R 3.2 , but the latest version of R currently available to use is R 3.4, any idea why it is not installing R 3.4 ?
I lately installed R.3.4 manually, it works fine. just curious to know why it didn't installed at the first place using the command.
Follow these steps:
Add this entry deb https://cloud.r-project.org/bin/linux/ubuntu xenial/ to your /etc/apt/sources.list file.
Run this command in shell: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9.
Update and install: sudo apt update; sudo apt install r-base.
I wrote a post that explains each step in detail (update: also covers installing R on Ubuntu 18.04); here's the link.
It installs 3.2 because that's the default in the Ubuntu 16.04 repository. If you want the most up to date version of R for Ubuntu it's best to follow the instructions at the cran page for R on Ubuntu.
The xenial-cran35/ version of the repo does NOT work if you have a "default release" set in apt, as is the case in some distros that work on top of Ubuntu, such as Mint. For my Mint distro, there exists a file /etc/apt/apt.conf.d/01ubuntu inside of which it declares the Default-Release "xenial"; What this means is that, since r-base exists in the ubuntu repo at version 3.2, with release "xenial", it'll never use the 3.6 branch from the other repo, because the release name for that repo is "xenial-cran35". You need to edit that file to change the default release to "xenail-cran35", or do something more pointed using apt preference files (https://wiki.debian.org/AptPreferences#A.2Fetc.2Fapt.2Fpreferences).
This is basically R's fault for having a poorly formatted repo. They should have had 2 repos, each of which had a "xenial" release folder, one url for their 3.2 branch work and one for the 3.5+ branch work. Instead they have one repo, and have bastardized the "release name" instead, which just sort of happens to work for base Ubuntu, but won't work if you have non-base configuration of apt in this way.

Installing R on Ubuntu

I am a new user of Ubuntu and facing lot problem in fetching R packages from the nearby CRAN repository. I am using Ubuntu v10.04 and R v2.14.1. I am not able to fetch package like twittR, plyR etc. . Can anyone tell me the appropriate steps for it as I have to use this for performing sentiment analysis on twitter data. is it because of old versions of the softwares??
First, get Ubuntu 14.04. What are you doing with 10.04?
Add the public key for the Ubuntu CRAN release:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
Add a nearby CRAN mirror to the deb list by editing the sources.list:
sudo nano /etc/apt/sources.list
In the file, add this line to the end of the file:
deb http://watson.nci.nih.gov/cran_mirror/bin/linux/ubuntu trusty/
This will add the Bethesda NIH R mirror to our ubuntu trusted sources list. Next, we will update apt-get packages:
sudo apt-get update
Finally, install (the updated versions of) Base-R and Dev-R:
sudo apt-get install r-base r-base-dev
To set up a shared library folder, edit .bash_profile and/or .bashrc to set up
R_LIBS_USER='directory_of_your_choice'.
Do make sure to set proper read/write permissions for your users. For more help, go the the AskUbuntu stack exchange.
Your software installation is five years old so you limit yourself to what was available five years ago. For current packages, use a current R on a current OS installation.
I update every six months (usually a month or two after the release) to the then-current Ubuntu version. Works like a charm.

Resources