gpt4 book ai didi

r - 在 Ubuntu "Precise"上安装 R 包

转载 作者:行者123 更新时间:2023-12-04 18:36:54 30 4
gpt4 key购买 nike

我正在尝试安装 R 包“raster”,并且在此处报告了相同的错误:Can not install ggplot package in R 2.14.1 .我认为处理这个问题的最好方法是升级 R,但我在这里做了咒语 http://cran.r-project.org/bin/linux/ubuntu/README ,但仍有 R 版本 2.14.1。

1)我还能做些什么来升级我的操作系统(Ubuntu Precise)上的 R,或者更新的 R 版本是否依赖于更新的 Ubuntu 版本?

2) 如果不升级操作系统就无法升级 R,如何为我的平台安装正确版本的“光栅”包?

最佳答案

您很可能错过了第一步或第二步。您需要拥有正确的 key (在 README 的“Secure Apt”部分中指定)并且您需要在/etc/atp/sources.list 文件中添加一行。实际上,我使用了足够多的不同发行版,以至于我有以下脚本可以在基于 Precise 的发行版上为我处理这个问题。

#!/usr/bin/env bash

## For newest versions of R
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9

# I'm sure there is a better way to add this line to
# the end of /etc/apt/sources.list but this works and I'm lazy
sudo sh -c "echo 'deb http://streaming.stat.iastate.edu/CRAN/bin/linux/ubuntu precise/' >> /etc/apt/sources.list"

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

这应该可以让您更新到最新版本的 R,并且从那里您应该可以毫无问题地获得最新版本的 ggplot2。

关于r - 在 Ubuntu "Precise"上安装 R 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22699243/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com