简体   繁体   English

在存档中安装R包

[英]Install R packages in archive

How can I install packages that are in archive, in Windows ? 如何在Windows中安装存档中的软件包?

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

When I try to install the tar.gz downloaded from the archive I get the following error: 当我尝试安装从存档下载的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' 

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

R CMD INSTALL packagename.tar.gz

You can try the function install_version in devtools . 您可以在devtools尝试install_version函数。 Let us suppose you want to install version 0.8 of ggplot2 , you can call it as install_version('ggplot2', '0.8') . 我们假设您要安装ggplot2 0.8版本,可以将其称为install_version('ggplot2', '0.8') If you are on Windows, you can follow the instructions here to build packages from source. 如果您使用的是Windows,则可以按照此处的说明从源代码构建软件包。

I had the same problem installing graph package from archive. 从存档安装图形包时遇到同样的问题。 The package is required for another package (bnclasify). 另一个包(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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM