简体   繁体   English

安装旧版本的R软件包时出错

[英]Error in in installing an old version of a R package

I tryed to install from file an old version of RgoogleMaps package with this command 我尝试使用此命令从文件中安装旧版本的RgoogleMaps软件包

install.packages("F://RgoogleMaps_1.1.9.15.tar.gz", repos = NULL, type="source")

but i found this error message: 但我发现此错误消息:

* installing *source* package 'RgoogleMaps' ...
** package 'RgoogleMaps' successfully unpacked and MD5 sums checked
ERROR: a 'NAMESPACE' file is required
* removing 'C:/Users/Famiglia Mazza/Documents/R/win-library/3.1/RgoogleMaps'
* restoring previous 'C:/Users/Famiglia Mazza/Documents/R/win-library/3.1/RgoogleMaps'
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-31~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\Famiglia Mazza\Documents\R\win-library\3.1" "F://RgoogleMaps_1.1.9.15.tar.gz"' had status 1
Warning in install.packages :
  installation of package ‘F://RgoogleMaps_1.1.9.15.tar.gz’ had non-zero exit status

what can I do? 我能做什么? I'm using R on Windows 我在Windows上使用R

In R 2.14.0 a requirement was made that all packages had namespaces, but as a transitional arrangement those that didn't would have one automatically generated at install time. R 2.14.0中 ,要求所有软件包都具有名称空间,但是作为过渡安排,那些没有安装的软件包将在安装时自动生成。

A package R code but without a 'NAMESPACE' file will have a default one created at R CMD build or R CMD INSTALL time, so all packages will be installed with namespaces. 软件包R代码但没有“ NAMESPACE”文件,将在R CMD构建或R CMD INSTALL时创建一个默认代码,因此所有软件包都将安装有名称空间。 A consequence of this is that .First.lib() functions need to be copied to .onLoad() (usually) or .onAttach(). 这样的结果是,需要将.First.lib()函数复制到.onLoad()(通常)或.onAttach()。 For the time being, if there is an auto-generated 'NAMESPACE' file and no .onLoad() nor .onAttach() function is found but .First.lib() is, it will be run as the attach hook (unless the package is one of a list of known exceptions, when it will be run as the load hook). 目前,如果存在自动生成的“ NAMESPACE”文件,但未找到.onLoad()或.onAttach()函数,但.First.lib()已存在,则它将作为附加挂钩运行(除非程序包是作为负载挂钩运行时的已知异常列表之一。

However, by R 3.0.0 this transitional arrangement was ended: 但是,在R 3.0.0中,此过渡安排已结束:

The transitional support for installing packages without namespaces (required since R 2.14.0) has been removed. 删除了对安装不带名称空间的软件包的过渡性支持(自R 2.14.0起需要)。 R CMD build will still add a namespace, but a .First.lib() function will need to be converted. R CMD构建仍将添加一个名称空间,但是.First.lib()函数将需要转换。

R CMD INSTALL no longer adds a namespace (so installation will fail), and a .First.lib() function in a package will be ignored (with an installation warning for now). R CMD INSTALL不再添加名称空间(因此安装将失败),并且包中的.First.lib()函数将被忽略(目前带有安装警告)。

As an exception, packages without a 'R' directory and no 'NAMESPACE' file can still be installed. 作为例外,没有'R'目录且没有'NAMESPACE'文件的软件包仍然可以安装。

Therefore, I suggest you use an older version of R to run this package. 因此,我建议您使用旧版本的R来运行此程序包。 One prior to R 3.0.0 should suffice, and the latest one prior to that is R 2.15.3 . R 3.0.0之前的一个应该足够,而R 3.5.3之前的最新是一个。

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

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