我无法在Windows上为R构建虚拟测试包.为了测试目的,在R终端,我输入:
a=rnorm(10)
package.skeleton("pkgtest")
Run Code Online (Sandbox Code Playgroud)
然后我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.
Run Code Online (Sandbox Code Playgroud)
编辑,完整的日志文件:
* 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'`
Run Code Online (Sandbox Code Playgroud)
就这些.我a在数据文件夹中有一个数据,所以它不是空的.Rd文件实际上可以编译为pdf Rcmd rd2pdf,其标题不为空.
我错过了一些非常基本的错误吗?我安装了Rtools2.12.我甚至有包inline和安装Rcpp和运行的例子很好.为了测试我的[R环境设置,我下载RCPP源码包,做了R cmd check上Rcpp,它都很好.
是的,如果您所做的只是上面记录的步骤,那么很多。
\n\n首先,您是否按照package.skeleton输出的要求进行操作?:
> a=rnorm(10)\n> package.skeleton("pkgtest")\nCreating directories ...\nCreating DESCRIPTION ...\nCreating Read-and-delete-me ...\nSaving functions and data ...\nMaking help files ...\nDone.\nFurther steps are described in \'./pkgtest/Read-and-delete-me\'.\nRun Code Online (Sandbox Code Playgroud)\n\n特别是最后一行。
\n\n你没有引用完整的检查日志,我得到:
\n\n$ R CMD check pkgtest\n* checking for working pdflatex ... OK\n* using log directory \'/home/gavin/tmp/pkgtest.Rcheck\'\n* using R version 2.11.1 Patched (2010-08-17 r52767)\n* using session charset: UTF-8\n* checking for file \'pkgtest/DESCRIPTION\' ... OK\n* checking extension type ... Package\n* this is package \'pkgtest\' version \'1.0\'\n* checking package dependencies ... OK\n* checking if this is a source package ... OK\n* checking for executable files ... OK\n* checking whether package \'pkgtest\' can be installed ... ERROR\nInstallation failed.\nSee \'/home/gavin/tmp/pkgtest.Rcheck/00install.out\' for details.\nRun Code Online (Sandbox Code Playgroud)\n\n所以你应该去检查它提到的文件的内容.out。我在该文件中有以下内容:
$ cat /home/gavin/tmp/pkgtest.Rcheck/00install.out\n* install options are \' --no-html\'\n\n* installing *source* package \xe2\x80\x98pkgtest\xe2\x80\x99 ...\n** R\n** data\n** preparing package for lazy loading\n** help\nWarning: ./man/pkgtest-package.Rd:34: All text must be in a section\nWarning: ./man/pkgtest-package.Rd:35: All text must be in a section\n*** installing help indices\nError in Rd_info(db[[i]]) : \n Rd files must have a non-empty \\title.\nSee chapter \'Writing R documentation\' in manual \'Writing R Extensions\'.\n* removing \xe2\x80\x98/home/gavin/tmp/pkgtest.Rcheck/pkgtest\xe2\x80\x99\nRun Code Online (Sandbox Code Playgroud)\n\n一旦你查看了包的源代码,这是相当不言自明的。
\n\n你至少需要:
\n\n> a=rnorm(10)\n> package.skeleton(name = "pkgtest", list = "a")\nRun Code Online (Sandbox Code Playgroud)\n\n然后您应该注意,您确实必须编辑 Rd 文件。这是一项设计功能prompt(),不会package.skeleton()创建有效的 Rd 文件来让包作者为其包编写最少的文档。