如何在 ubuntu 中升级 R? [英] How to upgrade R in ubuntu?

查看:37
本文介绍了如何在 ubuntu 中升级 R?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 ubuntu 中安装了 R 2.12.1,我想升级到最新版本 2.15,如何实现?谢谢

I have R 2.12.1 installed in my ubuntu, and I'd like upgrade to lastest version 2.15, how can achieve that ? Thanks

推荐答案

既然已经安装了 R,你应该可以用这个方法升级它.首先,你可能想把之前版本安装的包放到新版本里,方便查看这个发布.然后,按照此处

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

  1. 打开sources.list文件:

 sudo nano /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/
    

    https://cloud.r-project.org 替换为任何 镜像 您要使用并替换version/ 使用任何 version Ubuntu 你正在使用(例如,trusty/xenial/ 等).如果您收到格式错误的行错误",请检查 /ubuntu/version/ 之间是否有空格.

    Replace https://cloud.r-project.org with whatever mirror you 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/.

    获取安全 APT 密钥:

    Fetch the secure APT key:

     gpg --keyserver keyserver.ubuntu.com --recv-key E298A3A825C0D65DFD57CBB651716619E084DAB9
    

  •     gpg --hkp://keyserver keyserver.ubuntu.com:80 --recv-key E298A3A825C0D65DFD57CBB651716619E084DAB9
    

    1. 将其添加到钥匙圈:

    1. 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
    

  • 安装新版本

  • Install the new version

     sudo apt-get install r-base-dev
    

  • 按照最适合您的解决方案恢复旧包 (看到这个).例如,要恢复所有包(不仅仅是来自 CRAN 的包)的想法是:

  • 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:

    -- 将包从 R-oldversion/library 复制到 R-newversion/library,(不要覆盖新版本中已经存在的包!).

    -- copy the packages from R-oldversion/library to R-newversion/library, (do not overwrite a package if it already exists in the new version!).

    -- 运行 R 命令 update.packages(checkBuilt=TRUE, ask=FALSE).

    -- Run the R command update.packages(checkBuilt=TRUE, ask=FALSE).

    这篇关于如何在 ubuntu 中升级 R?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆