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

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

问题描述

我是Linux的新手.我正在使用Linux Mint 18.1.我已经使用系统软件管理器安装了R.我当前的R版本是3.2.但我想将其升级到3.4版.

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.

我该怎么办?

推荐答案


注意:我现在继续使用GitHub(此处)有关在Linux Mint或Ubuntu Linux上升级R的最新指南,其中还包括有关tidyverse,流行的数据处理软件包以及devtools,流行的R包开发...包.


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.

FedRo 提供的链接是很好的资源,但是由于您是使用Linux Mint 18.1,它使用Xenial仓库而不是Trusty仓库(请参见此处).我通常还会使用此处的方法来处理我在安装时已经安装的软件包升级R,而不是FedRo提供的方法.因此,为了完整起见,这些都是您需要采取的所有步骤:

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:

转到 CRAN的镜像列表,然后找到最接近的镜像的URL.给你.下面的终端命令假定您选择 http://cran.wustl.edu/

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/

打开终端并输入以下命令 1 (替换 http://cran.wustl .edu/与您在步骤1)中选择的CRAN镜像URL:

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

还请注意,我已经升级了r-baser-base-dev,但是我不知道您是否已安装r-base-dev.如果没有,我强烈建议您通过sudo apt install r-base-dev安装它.

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.

开始一个新的R会话并运行以下命令:

Start a new R session and run the following:

update.packages(checkBuilt=TRUE, ask=FALSE)

那你应该很好.

由于自从我回答了这个问题以来,Linux Mint和R都经历了升级,因此我正在为那些需要Linux Mint 19和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

您需要使用

sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu bionic-cran35/" | sudo tee -a /etc/apt/sources.list

(用您在步骤中选择的任何CRAN镜像URL替换 http://cran.wustl.edu/ 1)

(replacing http://cran.wustl.edu/ with whichever CRAN mirror URL you chose in step 1)

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

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

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