为什么devtools :: document()在函数定义为空的setMethod上跳闸?

时间:2019-02-05 18:08:54

标签: r devtools roxygen2

假设我正在RStudio中使用select name, status, message, completion_status, TO_CHAR( FROM_TZ( CAST(DATE '1970-01-01' + (1/24/60/60/1000) * completed AS TIMESTAMP), 'America/New_York'), 'yyyy-mm-dd HH24:MI:SS') as completed from Result; 构建一个R包。

假设我也有带有以下代码的R源文件:

=TEXT(A1, "[$-1010409]d/m/yyyy")

现在,devtools运行得很好,除了关于缺少名称/标题的警告:

#' @param object An object
#' @param data Numeric vector or data.frame
#' @param Fun Function. Default function is \code{sum}
#' @param ... Extra named arguments passed to FUN
#' @rdname myGeneric
#' @export
setGeneric("myGeneric", function(object, data, FUN, ...)
{standardGeneric ("myGeneric")} )

#' @rdname myGeneric
setMethod("myGeneric", c("numeric", "numeric", "function"),
          function(object, data, FUN, ...) {
            return(42)
            }
          )

但是,如果我像这样在函数定义中注释devtools::document(roclets=c('rd', 'collate', 'namespace'))行:

> devtools::document(roclets=c('rd', 'collate', 'namespace'))
Updating gwasrapidd documentation
Loading gwasrapidd
Writing NAMESPACE
Writing NAMESPACE
Warning message:
myGeneric.Rd is missing name/title. Skipping 

然后再次运行return(42),现在我得到一个错误:

#' @param object An object
#' @param data Numeric vector or data.frame
#' @param Fun Function. Default function is \code{sum}
#' @param ... Extra named arguments passed to FUN
#' @rdname myGeneric
#' @export
setGeneric("myGeneric", function(object, data, FUN, ...)
{standardGeneric ("myGeneric")} )

#' @rdname myGeneric
setMethod("myGeneric", c("numeric", "numeric", "function"),
          function(object, data, FUN, ...) {
            #return(42)
            }
          )

我的问题是为什么?是devtools::document(roclets=c('rd', 'collate', 'namespace'))的错误吗?

打包版本:

  • devtools_1.13.6
  • roxygen2_6.1.1

1 个答案:

答案 0 :(得分:0)

这似乎是roxygen中的错误:https://github.com/klutometis/roxygen/issues/843