Windows安装R软件包

4
我正在运行64位的Ubuntu。我有一个极简测试软件包,我制作了这个软件包来学习如何做这些事情(我遵循这个教程,除此之外我还在包中加入了一些C代码)。当我运行它时,会出现以下错误信息:
R CMD check MySmallPackage

在IT技术方面,当我运行它时,它可以正常工作(请参见下文)。然后,我运行

R CMD build MySmallPackage

它也能正常工作(见下文)。所以现在,我把生成的.tar.gz文件发送给一个运行win7 64位(和64位R)的朋友,他收到了这个错误信息:

*** arch - i386
ERROR: compilation failed for package 'MySmallPackage'
* removing 'C:/Users/ES/Documents/R/win-library/2.15/MySmallPackage'
Warning in install.packages :
  running command 'C:/PROGRA~1/R/R-215~1.1/bin/x64/R CMD INSTALL -l "C:/Users/ES/Documents/R/win-library/2.15"   "C:/Users/ES/Downloads/MySmallPackage_0.1.1(1).tar.gz"' had status 1
Warning in install.packages :
  installation of package ‘C:/Users/ES/Downloads/MySmallPackage_0.1.1(1).tar.gz’ had non-zero exit status

这非常令人困惑。有谁能指出可能导致此问题的原因吗(我多年没有使用Windows了,但在Linux上安装软件包很顺利)。对我来说,错误信息有点难以理解。

$ R CMD check MySmallPackage
* using log directory ‘~/MySmallPackage.Rcheck’
* using R version 2.15.2 (2012-10-26)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘MySmallPackage/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘MySmallPackage’ version ‘0.1.1’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking whether package ‘MySmallPackage’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking for unstated dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking for portable compilation flags in Makevars ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... OK
* checking examples ... OK
* checking PDF version of manual ... OK


$R CMD build MySmallPackage
* checking for file ‘MySmallPackage/DESCRIPTION’ ... OK
* preparing ‘MySmallPackage’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building ‘MySmallPackage_0.1.1.tar.gz’
1个回答

5

你需要为Linux、Mac和Windows机器构建不同的软件包。

有至少四种可能性:

  1. 将你的软件包托管在r-forge上。每晚r-forge会构建软件包的linux、windows和mac版本。
  2. 使用由Uwe Ligges维护的在线Windows 软件包构建器
  3. 将源代码发送给你的朋友,并让他在Windows机器上构建软件包。当我谷歌搜索“在Windows上构建R软件包”时,我得到了一些有用的结果。
  4. 将你的软件包托管在github上,然后使用devtools软件包安装该软件包。

'2.' 已经运行并生成了一个可用的 .zip 文件。但是速度非常慢!我认为这值得提出一个新问题。 - user189035
1
但是第四步并不能帮助构建,您仍然需要使用Rtools。 - Dirk Eddelbuettel
@DirkEddelbuettel 我在想本地计算机管理员会安装devtools和Rtools,因为这些是“正式”的R包。然而,本地计算机管理员没有时间去安装定制的软件包。 - csgillespie
看,如果本地管理员能够安装Rtools,那么OP就不会有关于在Windows上构建的问题了。你提到的第4点是废话。其他三个点非常好和相关,特别是win-builder并不像它应该被知道的那样知名。 - Dirk Eddelbuettel
@DirkEddelbuettel 在这里(以及许多其他大学),管理员很乐意安装软件包,但如果您要求他们不断更新软件包,他们会感到非常恼火。 install_github 选项将允许我立即更改一个软件包,其他非技术用户可以立即安装。我同意其他选项更好(因此排序),而此选项是“轻浮”的,但仍然可能有用。顺便说一句,任何更多的评论都应该移动到聊天中;) - csgillespie
显示剩余2条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接