Install latest R for ubuntu


### delete old version
rm -rf /usr/local/lib/R
/usr/lib/R
~/**/R
sudo apt-get autoremove rstudio
sudo apt-get autoremove r-base-core

### install new version
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install r-base

update.packages(ask = FALSE, dependencies = c('Suggests'))

sudo apt-get install libcurl4-gnutls-dev (install.pakages("curl"))

Follow these steps:

  1. Add this entry deb https://cloud.r-project.org/bin/linux/ubuntu xenial/ to your /etc/apt/sources.list file.

  2. Run this command in shell: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9.

  3. Update and install: sudo apt update; sudo apt install r-base.

 

Add this entry deb https://cloud.r-project.org/bin/linux/ubuntu xenial/ to your /etc/apt/sources.list file.

sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:4 http://cn.archive.ubuntu.com/ubuntu xenial InRelease
Hit:5 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:6 http://cn.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:7 http://cn.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:8 https://download.sublimetext.com apt/stable/ InRelease
Get:9 https://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease [3,607 B]
Ign:9 https://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease
Get:10 https://cloud.r-project.org/bin/linux/ubuntu xenial/ Packages [85.3 kB]
Fetched 88.9 kB in 2s (31.7 kB/s)
Reading package lists... Done
W: GPG error: https://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9
W: The repository 'https://cloud.r-project.org/bin/linux/ubuntu xenial/ InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9

sudo apt-get update

sudo apt install r-base




原文地址:https://www.cnblogs.com/xiaojikuaipao/p/5107781.html