“安装软件包"FILE_PATH"的退出状态为非零"在R中
通过使用以下命令在R中安装软件包:
By installing the package in R using the following command:
install.packages('FILE_PATH', repos=NULL, type = "source")
我遇到以下错误:
将软件包安装到"/home/p/R/x86_64-pc-linux-gnu-library/3.0" (因为未指定"lib") rawToChar(block [seq_len(ns)])中的错误: 字符串中嵌入的nul:'PK \ 003 \ 004 \ 024 \ 0 \ 002 \ 0 \ b \ 0] \ xadVCr \ xcb \ xea \ xfcR \ 0 \ 0 \ 0 \ xa7 \ 0 \ 0 \ 0 \ 0 \ 027 \ 0 \ 0 \ 0bivpois-Rcode/.Rhistory + \ xce/-JN \ xd5PO \ xca,+ \ xc8 \ xcf,\ xd6 + IL \ xcaI \ xd5 \ vR \ xd7 \ xe4 \ xe5 * \ x86J \ xe5 \ xe4 \ xea %\ 025` \ b \ xa5d \ xa2 \ v楖\ xe7%\ xe6' 警告信息: 在install.packages("/home/p/Research/14_bivpois-Rcode.zip"中,repos = NULL,: 软件包"/home/p/Research/14_bivpois-Rcode.zip"的安装退出状态为非零
Installing package into ‘/home/p/R/x86_64-pc-linux-gnu-library/3.0’ (as ‘lib’ is unspecified) Errore in rawToChar(block[seq_len(ns)]) : embedded nul in string: 'PK\003\004\024\0\002\0\b\0]\xadVCr\xcb\xea\xfcR\0\0\0\xa7\0\0\0\027\0\0\0bivpois-Rcode/.Rhistory+\xce/-JN\xd5PO\xca,+\xc8\xcf,\xd6+IL\xcaI\xd5\vR\xd7\xe4\xe5*\x86J\xe5\xe4\xea%\025`\b\xa5d\xa2\v楖\xe7%\xe6' Warning message: In install.packages("/home/p/Research/14_bivpois-Rcode.zip", repos = NULL, : installation of package ‘/home/p/Research/14_bivpois-Rcode.zip’ had non-zero exit status
R版本是3.0.2 (2013-09-25) -- "Frisbee Sailing"
,操作系统是Linux Mint(UNIX).
The R version is the 3.0.2 (2013-09-25) -- "Frisbee Sailing"
and the OS is Linux Mint (UNIX).
我为什么会收到该错误及其含义:
Why Do I get that error and what does it mean:
安装软件包"/home/p/Research/14_bivpois-Rcode.zip"的退出状态为非零
installation of package ‘/home/p/Research/14_bivpois-Rcode.zip’ had non-zero exit status
在R中?
您可以在此处和文件
You can find the package here and the file 14_bivpois-Rcode.zip
is the source.
我尝试将其安装在本地,并且该路径是正确的路径.
I tried to install that locally and the path is the correct one.
是否有建议在UNIX中安装该软件包?
Any suggestion to install that package in UNIX?
作者提供的.zip文件不是有效的R程序包,他们确实声明源文件是R中的直接使用"文件(通过我认为它们意味着有必要手动加载所包含的函数). non-zero exit status
只是表明在软件包"的安装过程中发生了错误.
The .zip file provided by the authors is not a valid R package, and they do state that the source is for "direct use" in R (by which I assume they mean it's necessary to load the included functions manually). The non-zero exit status
simply indicates that there was an error during the installation of the "package".
您可以手动提取存档,然后使用例如source('bivpois.table.R')
加载其中的功能,也可以下载它们提供的.RData文件,然后使用load('.RData')
将其加载到工作区中.这不会将功能作为软件包的一部分安装;而是将功能加载到您的全局环境中,使其暂时可用.
You can extract the archive manually and then load the functions therein with, e.g., source('bivpois.table.R')
, or you can download the .RData file they provide and load that into the workspace with load('.RData')
. This does not install the functions as part of a package; rather, it loads the functions into your global environment, making them temporarily available.
您可以按照以下步骤从R下载,提取和加载.RData:
You can download, extract, and load the .RData from R as follows:
download.file('http://stat-athens.aueb.gr/~jbn/papers/files/14/14_bivpois_RDATA.zip',
f <- tempfile())
unzip(f, exdir=tempdir())
load(file.path(tempdir(), '.RData'))
如果您希望.RData文件在当前工作目录中可用,并在将来加载,则可以使用以下代码代替:
If you want the .RData file to be available in the current working directory, to be loaded in the future, you could use the following instead:
download.file('http://stat-athens.aueb.gr/~jbn/papers/files/14/14_bivpois_RDATA.zip',
f <- tempfile())
unzip(f, exdir=tempdir())
file.copy(file.path(tempdir(), '.RData'), 'bivpois.RData')
# the above copies the .RData file to a file called bivpois.RData in your current
# working directory.
load('bivpois.RData')
在以后的R会话中,您只需拨打load('bivpois.RData')
.
In future R sessions, you can just call load('bivpois.RData')
.