问题描述
通过使用以下命令在R中安装软件包:
By installing the package in R using the following command:
install.packages('FILE_PATH', repos=NULL, type = "source")
我遇到以下错误:
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:
在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')
.
这篇关于“安装软件包"FILE_PATH"的退出状态为非零"在R中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!