[英]Warning while installing package in R
I have been trying to install the ggplot2 package in R and this is the warning I have been getting: 我一直在尝试在R中安装ggplot2软件包,这是我得到的警告:
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open the connection read.dcf(file.path(pkgname,“ DESCRIPTION”),c(“ Package”,“ Type”))中的错误:无法打开连接
In addition: Warning messages: 另外:警告消息:
1: In download.file(url, destfile, method, mode = "wb", ...) : downloaded length 1040720 != reported length 1152839 1:在download.file(url,destfile,method,mode =“ wb”,...)中:下载长度1040720!=报告长度1152839
2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file 2:在解压缩(zipname,exdir = dest)中:从zip文件提取错误1
3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open compressed file 'plyr/DESCRIPTION', probable reason 'No such file or directory' 3:在read.dcf(file.path(pkgname,“ DESCRIPTION”),c(“ Package”,“ Type”))中:无法打开压缩文件'plyr / DESCRIPTION',可能的原因是'No such file or directory'
It might be helpful to note that I am using the version 3.1.1. 注意,我正在使用版本3.1.1。 Could you please help me understand what went wrong and how I could resolve this? 您能否帮助我了解问题出在哪里以及如何解决呢?
Thank you in advance. 先感谢您。
From the comments we discovered that somehow your repos
option had been set to a bad value. 从评论中,我们发现您的repos
选项被设置为错误的值。
install.packages
has an argument called repos
that can be used to specify where to find the package that you'd like to install. install.packages
有一个称为repos
的参数,可用于指定在哪里找到要安装的软件包。 If you specify a valid value, it should just work. 如果您指定一个有效值,它应该可以正常工作。 eg you shouldn't get the error if you do this: install.packages("ggplot2", repos="http://cran.us.r-project.org")
例如,如果您执行此操作,则不会收到错误: install.packages("ggplot2", repos="http://cran.us.r-project.org")
If you do not provide a value, it will look at the repos
option. 如果不提供值,它将查看repos
选项。 See getOption("repos")
to see what is set. 请参见getOption("repos")
以查看设置了什么。 In your case it was 你的情况是
CRAN CRANextra
"freestatistics.org/cran" "stats.ox.ac.uk/pub/RWin"
neither of which are valid URLs. 这两个都不是有效的URL。
You can change the value of the repos
option like this 您可以像这样更改repos
选项的值
options(repos=c(CRAN="@CRAN@",
CRANextra="http://www.stats.ox.ac.uk/pub/RWin"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.