我试图在Windows 7上安装R-2.14.0的软件包rpart
,但是我得到警告:
软件包'rpart'不可用(R版本2.14.0)
所以我从包页面下载tar.gz文件。 我已经安装了Rtools,但是我禁用了所有的选项,包括改变PATH的选项。 然后我执行以下操作:
> install.packages("C:/rpart_3.1-50.tar.gz", type="source") Installing package(s) into 'C:/Users/backupSam/Documents/R/win-library/2.14' (as 'lib' is unspecified) inferring 'repos = NULL' from the file name * installing *source* package 'rpart' ... ** libs *** arch - i386 ERROR: compilation failed for package 'rpart' * removing 'C:/Users/backupSam/Documents/R/win-library/2.14/rpart' * restoring previous 'C:/Users/backupSam/Documents/R/win-library/2.14/rpart' Warning messages: 1: running command 'C:/PROGRA~1/R/R-214~1.0/bin/i386/R CMD INSTALL -l "C:/Users/backupSam/Documents/R/win-library/2.14" "C:/rpart_3.1-50.tar.gz"' had status 1 2: In install.packages("C:/rpart_3.1-50.tar.gz", type = "source") : installation of package 'C:/rpart_3.1-50.tar.gz' had non-zero exit status
有什么build议么?
既然你必须设置PATH
,但是你却犹豫不决,因为你担心你可能会弄出一些东西,你可以在你的R会话中通过以下方式临时完成:
pathRtools <- paste(c("c:\\Rtools\\bin", "c:\\Rtools\\MinGW\\bin", "c:\\MiKTeX\\miktex\\bin", "c:\\R\\bin\\i386", "c:\\windows", "c:\\windows\\system32"), collapse=";") Sys.setenv(PATH=paste(pathRtools,Sys.getenv("PATH"),sep=";"))