“安装包‘FILE_PATH’的退出状态非零";在 R [英] "installation of package 'FILE_PATH' had non-zero exit status" in 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 03 04 24 02 ]xadVCrxcbxeaxfcR xa7 27 bivpois-Rcode/.Rhistory+xce/-JNxd5POxca,+xc8xcf,xd6+ILxcaIxd5vRxd7xe4xe5*x86Jxe5xe4xea% 25`xa5dxa2v楖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 03 04 24 02 ]xadVCrxcbxeaxfcR xa7 27 bivpois-Rcode/.Rhistory+xce/-JNxd5POxca,+xc8xcf,xd6+ILxcaIxd5vRxd7xe4xe5*x86Jxe5xe4xea% 25`xa5dxa2v楖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 中?
您可以在此处找到包和文件14_bivpois-Rcode.zip
是来源.
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 中直接使用"(由此我认为他们的意思是有必要手动加载包含的功能).非零退出状态
仅表示安装包"期间出现错误.
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')
.
这篇关于“安装包‘FILE_PATH’的退出状态非零";在 R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!