This question already has an answer here:
R: Cannot install rJava; what is r-api-3.4?

(1个答案)


1年前关闭。




我需要在debian Stretch上运行3.6-我按照此处的说明进行操作:

https://cran.r-project.org/bin/linux/debian/

并使用了这个仓库:

http://lib.stat.cmu.edu/R/CRAN/bin/linux/debian Stretch-cran35/

我能够安装它。但是我需要2个软件包,r-cran-caret和
r-cran-ggplot2将无法安装:
# apt-get install r-cran-ggplot2
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-cran-ggplot2 : Depends: r-api-3
                  Depends: r-cran-digest but it is not going to be installed
                  Depends: r-cran-gtable (>= 0.1.1) but it is not
going to be installed
                  Depends: r-cran-plyr (>= 1.7.1) but it is not going
to be installed
                  Depends: r-cran-reshape2 but it is not going to be installed
                  Depends: r-cran-scales (>= 0.4.1) but it is not
going to be installed
                  Depends: r-cran-tibble but it is not going to be installed
                  Depends: r-cran-lazyeval but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

有没有办法为我的环境获取这两个软件包?

最佳答案

我不确定这是否可以解决您的问题。

sudo dpkg --configure -a

在这些情况下,我发现更容易使用智能
sudo apt install aptitude
sudo aptitude install r-cran-ggplot2

当然,如果ggplot2有效,您也可以尝试使用脱字符。

但是,问题是,如果您将R装入终端并尝试在R中安装这些软件包,会得到什么样的错误消息(如果有的话)?

在终端中输入R并加载后
install.packages("ggplot2",dependencies=TRUE)

这样做时会收到什么错误消息?

另一个常见的问题是,您尝试安装的软件包的版本确实安装在您使用的R版本中。在这种情况下,您必须从cran下载该软件包,解压缩并从本地文件安装。

打开一个终端并输入R然后在 session 类型中输入
packageurl <- "https://cran.r-project.org/src/contrib/ggplot2_3.2.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source", dependencies=TRUE)

如果您有版本控制的常见问题,则希望此命令不会打扰检查ggplot的版本和R的版本。

或者,如果您不想在终端中显式启动R session 类型
wget https://cran.r-project.org/src/contrib/ggplot2_3.2.0.tar.gz
R CMD INSTALL ggplot2_3.2.0.tar.gz repos=NULL type="source" dependencies=TRUE

关于R 3.6在Debian上,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57313262/

10-12 17:47