[英]“Could not find function” in Roxygen examples during CMD check
I'm running a CMD check on a package in RStudio, part of which analyses the @examples
in the inline Roxygen documentation. 我在RStudio,其中一部分的分析上运行包中的CMD检查
@examples
内嵌Roxygen文档。
I'm getting this error: 我收到此错误:
checking examples ... ERROR
Running examples in ‘packagename-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: checkDate
> ### Title: Ensure that a date string is a valid date
> ### Aliases: checkDate
>
> ### ** Examples
>
> checkDate("2017-05-06")
Error: could not find function "checkDate"
Within my .R file, the documentation is defined as: 在我的.R文件中,文档定义为:
#' Ensure that a date string is a valid date
#'
#' @param dateString A string (eg. "2017-12-04").
#' @return TRUE or FALSE (and a warning if FALSE).
#' @examples
#' checkDate("2017-05-06")
#' checkDate("2017-05-40")
I am using devtools 1.13.2 and roxygen2 6.0.1, both of which I believe to be up-to-date at time of posting. 我正在使用devtools 1.13.2和roxygen2 6.0.1,我认为它们在发布时都是最新的。
I have other packages using this same devtools/roxygen2 combination but have never before seen it fail to find a function name in @examples
within its scope. 我还有其他使用相同的devtools / roxygen2组合的软件包,但从未见过它无法在其范围内的
@examples
找到函数名称。
Someone else seems to have experienced something similar as an update to this question , but I can't see that anyone says how to fix it. 似乎有人对这个问题进行了更新,但是我看不到有人说如何解决。
我的猜测是,您需要#' @export
Roxygen注释中的函数,否则该函数将不会导出到包的名称空间,并且无法找到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.