安装最新版本的 R-base

安装最新版本的 R-base

我一直尝试安装最新版本(2.15.2),但没有成功r-base。 显然,R软件包Rcpp无法安装 R 版本 2.14.1 - 该版本适合我安装。

我不确定要更改下面显示的安装尝试的内容/方法/位置。请注意,我使用的是 ubuntu-12.04.1-server-i386。

当前安装的版本是R版本2.14.1(2011-12-22):

$ sudo apt-get install r-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
r-base is already the newest version.

包括版本信息没有帮助:

$ sudo apt-get install r-base=2.15.1-5ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '2.15.1-5ubuntu1' for 'r-base' was not found

根据 CRAN Ubuntu 说明进行更改http://cran.r-project.org/bin/linux/ubuntu/README

  1. 添加到/etc/apt/sources.list

    deb http://lib.stat.cmu.edu/R/CRAN/bin/linux/ubuntu quantal/
    
  2. 更新并安装

    $ sudo apt-get update
    $ sudo 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-base-core (>= 2.15.2-1quantal2) but it is not going to be installed
              Depends: r-recommended (= 2.15.2-1quantal2) but it is not going to be installed
              Recommends: r-base-html but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

答案1

以上都不适用于我,所以我复制了答案https://stackoverflow.com/questions/16093331/how-to-install-r-version-3-0

卸载旧 R:

sudo apt-get remove r-base-core

然后:

sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -sc)/"

然后将这些命令复制/粘贴到命令行中:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base

对我有用

答案2

这是我的方法;

正如问题中提到的,我经历了适用于 R 的 UBUNTU 软件包按照说明添加存储库,并执行 apt-get 更新,然后

apt-cache showpkg r-base 

这将得到类似


Package: r-base
Versions: 
3.0.2-1raring0 (/var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages
                  MD5: 5787ca79ed716232c4cc2087ed9b425b

3.0.1-6raring0 (/var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages
                  MD5: 5787ca79ed716232c4cc2087ed9b425b

我做了一个

 sudo apt-get install -f r-base=3.0.2-1raring0

并做了。

答案3

打开终端并输入sudo -s。然后source.list输入以下内容打开:

gedit /etc/apt/sources.list

然后,将以下行添加到文件中:

deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu quetzal/

然后保存并退出 gedit。在终端中输入

gpg --keyserver keyserver.ubuntu.com --recv-key E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9| sudo apt-key add -

然后输入

exit

然后逐行输入这些命令。

sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev

答案4

我注意到一件事,如果你按照各种 R 网站上的说明操作,这些说明会让你在 Linux 源列表中添加一行 /etc/apt/sources.list

例如,请参阅以下链接:https://www.r-bloggers.com/how-to-install-r-on-linux-ubuntu-16-04-xenial-xerus/

但是,一些 Linux 发行版会在此文件夹中的单独文件中添加一行: /etc/apt/sources.list.d

这可能会导致you have held broken packages错误消息。

我注释掉了 ( /etc/apt/sources.list) 中的行/etc/apt/sources.list,并使用我的发行版 (Linux Mint 18.3) 的软件源管理器添加了正确的 R 存储库

这解决了问题。

相关内容