Update R
全文的原始链接如下,为了丢失,特保存文本如下:
https://stackoverflow.com/questions/10476713/how-to-upgrade-r-in-ubuntu
Since R is already installed, you should be able to upgrade it with this method. First of all, you may want to have the packages you installed in the previous version in the new one,so it is convenient to check this post. Then, follow the instructions from here
Open the sources.list file:
sudo vim /etc/apt/sources.list
Add a line with the source from where the packages will be retrieved. For example:
deb https://cloud.r-project.org/bin/linux/ubuntu/ version/
我换成了deb https://cloud.r-project.org/bin/linux/ubuntu/ xenial-cran35/ 这样就装3.5版本的R了。。。so smart。。哈哈。"/"不能少
Replace https://cloud.r-project.org with whatever mirroryou would like to use, and replace version/ with whatever version of Ubuntu you are using (eg, trusty/, xenial/, and so on). If you're getting a "Malformed line error", check to see if you have a space between /ubuntu/ and version/.
Fetch the secure APT key:
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
or
gpg --hkp://keyserver keyserver.ubuntu.com:80 --recv-key E084DAB9
Add it to keyring:
gpg -a --export E084DAB9 | sudo apt-key add -
Update your sources and upgrade your installation:
sudo apt-get update && sudo apt-get upgrade
我只update了一下,没有系统升级。
Install the new version
sudo apt-get install r-base-dev
我装的是r-base
Recover your old packages following the solution that best suits to you (see this). For instance, to recover all the packages (not only those from CRAN) the idea is:
-- copy the packages from R-oldversion/library to R-newversion/library, (do not overwrite a package if it already exists in the new version!).
-- Run the R command update.packages(checkBuilt=TRUE, ask=FALSE).
这些步骤都没操作,因为我自己有单独的R包安装目录。