首先,我的这种说法是我第一次发帖,这有点令人费解 . 我试图尽可能简单地演示这个问题 . 我在Windows 10上使用R studio(1.0.44)运行R(3.3.2) .

当我从包含Rcpp的另一个主内置包导入的包上运行'Check Package'时,我在'检查是否可以安装包'部分中遇到生成错误 .

这就是我所做的......

首先,我在我的电脑上创建了一个包含一些新软件包C:/ Rtest /的文件夹 .

使用RStudio我创建了一个新包(类型:包,名称:“testRpack”) . 我将DESCRIPTION中的许可证更新为有效代码(GPL) . 我在文件夹“R”和“man”中的文件中将“hello”的每个实例更改为“helloR”,包括文件名(即“hello.R”变为“helloR.R”,并且“hello.Rd”变为“helloR.Rd”) . 然后我做了Build&Reload,然后是Check Package . 它没有报告错误,警告或说明 .

现在,再次使用RStudio,我创建了一个新包(类型:包w / Rcpp,名称:“testRcpp”) . 我像以前一样更新了DESCRIPTION中的许可证 . 然后我做了Build&Reload,然后是Check Package . 它没有报告错误,警告或说明 .

最后,我使用RStudio创建了另一个新包(类型:包,名称:“testMe”) . 我在文件夹“R”和“man”中的文件中将“hello”的每个实例更改为“helloMe”,并更新了DESCRIPTION中的许可证 . 我执行了Build&Reload,然后是Check Package . 它没有报告错误,警告或说明 .

现在,在Package“helloMe”中,我将“配置构建工具”更改为“使用Roxygen生成文档” . 我将Roxygen笔记添加到“helloMe.R”文件中,如下所示:

#' HelloMe, World!
#' @title HelloMe, World!
#' @aliases helloMe
#' @export
#' @description Prints 'HelloMe, world!'.
#' @examples
#'    helloMe()
#' @importFrom testRpack helloR
helloMe <- function() {
  print("HelloMe, world!")
  helloR()
}

并通过添加以下行来更新DESCRIPTION文件以导入testRpack:

Imports:
    testRpack

我在RStudio中运行Build&Reload然后检查包功能,它没有报告任何错误,警告或注释 .

最后,我还通过将DESCRIPTION文件中的Import部分更新为:来导入testRcpp包:

Imports:
    testRpack,
    testRcpp

并将“helloMe.R”文件更改为:

#' HelloMe, World!
#' @title HelloMe, World!
#' @aliases helloMe
#' @export
#' @description Prints 'HelloMe, world!'.
#' @examples
#'    helloMe()
#' @importFrom testRpack helloR
#' @importFrom testRcpp hello
helloMe <- function() {
  print("HelloMe, world!")
  helloR()
  hello()
}

我现在像以前一样执行Build&Reload然后执行Check Package . 这次Check Package报告1错误 . 完整的读数如下:

==> devtools::check()

Updating testMe documentation
Loading testMe
Writing NAMESPACE
Writing helloMe.Rd
Setting env vars ---------------------------------------------------------------
CFLAGS  : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building testMe ----------------------------------------------------------------
"C:/R/Program/R-33~1.2/bin/x64/R" --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD build "C:\Rtest\testMe" --no-resave-data  \
  --no-manual 

* checking for file 'C:\Rtest\testMe/DESCRIPTION' ... OK
* preparing 'testMe':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building 'testMe_0.1.0.tar.gz'

Setting env vars ---------------------------------------------------------------
_R_CHECK_CRAN_INCOMING_ : FALSE
_R_CHECK_FORCE_SUGGESTS_: FALSE
Checking testMe ----------------------------------------------------------------
"C:/R/Program/R-33~1.2/bin/x64/R" --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD check  \
  "C:\Users\KURT~1.BAL\AppData\Local\Temp\Rtmp6xObJv/testMe_0.1.0.tar.gz"  \
  --as-cran --timings --no-manual 

* using log directory 'C:/Rtest/testMe.Rcheck'
* using R version 3.3.2 (2016-10-31)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using options '--no-manual --as-cran'
* checking for file 'testMe/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'testMe' version '0.1.0'
* package encoding: UTF-8
* 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 for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'testMe' can be installed ... ERROR
Installation failed.
See 'C:/Rtest/testMe.Rcheck/00install.out' for details.
* DONE
Status: 1 ERROR
Warning: running command '"C:/R/Program/R-33~1.2/bin/x64/Rcmd.exe" INSTALL -l "C:/Rtest/testMe.Rcheck" --no-html "C:\Rtest\TESTME~1.RCH\00_PKG~1\testMe"' had status 1

See
  'C:/Rtest/testMe.Rcheck/00check.log'
for details.

checking whether package 'testMe' can be installed ... ERROR
Installation failed.
See 'C:/Rtest/testMe.Rcheck/00install.out' for details.
R CMD check results
1 error  | 0 warnings | 0 notes

R CMD check succeeded

文件夹'C:/Rtest/testMe.Rcheck/'不存在,因此文件'00install.out'也不存在 . 我注意到(在文件资源管理器窗口中)它是在Check正在进行时创建的,但后来被删除了 .

尽管报告了这个错误,但在运行函数“helloMe()”时,我得到了所需的输出:

> helloMe()
[1] "HelloMe, world!"
[1] "HelloR, world!"
[1] "Hello, world

换句话说,包看起来没问题,但Check Package报告错误 .

当我还将“rcpp_hello()”添加到“helloMe”函数时,行为是相同的 - 我按预期添加了列表输出 .

任何人都可以解释我在这里缺少的东西吗?

谢谢 .