gpt4 book ai didi

r - 为 Windows 构建 R 包 -ERROR : compilation failed for package xxx

转载 作者:行者123 更新时间:2023-12-04 20:22:55 25 4
gpt4 key购买 nike

我无法在 Windows 上为 R 构建虚拟测试包。
出于测试目的,在 R 终端,我输入:

a=rnorm(10)
package.skeleton("pkgtest")

然后我跑 R CMD check pkgtest在这个虚拟包上,得到了类似的错误
* using R version 2.12.0 (2010-10-15)
* using platform: i386-pc-mingw32 (32-bit)
* using session charset: ISO8859-1
* checking for file 'pkgtest/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'pkgtest' version '1.0'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for executable files ... OK
* checking whether package 'pkgtest' can be installed ... ERROR Installation failed.

编辑 ,完整的日志文件:
* installing *source* package 'pkgtest' ...
** libs
cygwin warning:
MS-DOS style path detected: C:/R/R-212~1.0/etc/i386/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R/R-212~1.0/etc/i386/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
ERROR: compilation failed for package 'pkgtest'
`* removing 'C:/DOCUME~1/xxxx'`

就这些。我有资料 a在数据文件夹中,所以它不是空的。 Rd 文件实际上可以通过 Rcmd rd2pdf 编译为 pdf。 ,其标题不为空。

对于这个错误,我是否遗漏了一些非常基本的东西?我安装了 Rtools2.12。我什至有包裹 inlineRcpp安装和运行示例很好。
为了测试我的 R 环境设置,我下载了 Rcpp 源包并做了一个 R cmd checkRcpp ,一切顺利。

最佳答案

是的,如果您所做的只是上面记录的步骤,那就很多了。

首先,你做了 package.skeleton 的输出吗?要你吗?:

> a=rnorm(10)
> package.skeleton("pkgtest")
Creating directories ...
Creating DESCRIPTION ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './pkgtest/Read-and-delete-me'.

特别是最后一行。

你没有引用完整的 CHECK 日志,我得到:
$ R CMD check pkgtest
* checking for working pdflatex ... OK
* using log directory '/home/gavin/tmp/pkgtest.Rcheck'
* using R version 2.11.1 Patched (2010-08-17 r52767)
* using session charset: UTF-8
* checking for file 'pkgtest/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'pkgtest' version '1.0'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for executable files ... OK
* checking whether package 'pkgtest' can be installed ... ERROR
Installation failed.
See '/home/gavin/tmp/pkgtest.Rcheck/00install.out' for details.

所以你应该去检查 .out的内容。它提到的文件。我在该文件中有以下内容:
$ cat /home/gavin/tmp/pkgtest.Rcheck/00install.out
* install options are ' --no-html'

* installing *source* package ‘pkgtest’ ...
** R
** data
** preparing package for lazy loading
** help
Warning: ./man/pkgtest-package.Rd:34: All text must be in a section
Warning: ./man/pkgtest-package.Rd:35: All text must be in a section
*** installing help indices
Error in Rd_info(db[[i]]) :
Rd files must have a non-empty \title.
See chapter 'Writing R documentation' in manual 'Writing R Extensions'.
* removing ‘/home/gavin/tmp/pkgtest.Rcheck/pkgtest’

一旦您查看包源,这是不言自明的。

你至少需要:
> a=rnorm(10)
> package.skeleton(name = "pkgtest", list = "a")

然后你应该注意到你必须编辑 Rd 文件。 prompt()是一个设计特点和 package.skeleton()不要创建有效的 Rd 文件来让包作者为其包编写最少的文档。

关于r - 为 Windows 构建 R 包 -ERROR : compilation failed for package xxx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4327457/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com