在存档中安装R包

时间:2012-02-06 14:21:36

标签: r package install

如何在Windows中安装存档的软件包?

http://cran.r-project.org/src/contrib/Archive/

当我尝试安装从存档下载的tar.gz时,出现以下错误:

Error in gzfile(file, "r") : cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In gzfile(file, "r") :
  cannot open compressed file 'grasp_2.5-7.tar.gz/DESCRIPTION', probable reason 'No such file or directory'

3 个答案:

答案 0 :(得分:5)

您可以下载源代码(tar.gz文件)并使用以下命令安装它们:

R CMD INSTALL packagename.tar.gz

答案 1 :(得分:5)

您可以在install_version中尝试devtools功能。我们假设您要安装ggplot2版本0.8,可以将其称为install_version('ggplot2', '0.8')。如果您使用的是Windows,则可以按照here的说明从源代码构建软件包。

答案 2 :(得分:0)

我在存档中安装图形包时遇到同样的问题。另一个包(bnclasify)需要该包。

chooseBioCmirror() #select a different mirror than CRAN. This mirror may be #because is the one that has bnclasify in it (check this statement)

setRepositories() #In here you can select as many as you want to search for the       #package you need

ap <- available.packages() #list of all available packages

"graph" %in% rownames(ap) #search the package you need by name (return TRUE or #FALSE). 

install.packages("graph", dependencies=TRUE) #if the last statement TRUE then #install the package like normally