roxygen2错误“错误:不知道如何在数据中描述s3方法。”

时间:2016-07-31 15:56:32

标签: r roxygen2

当我尝试devtools::document()我的R包时,我得到了结果:

Updating janitor documentation
Loading janitor
Writing NAMESPACE
Error: Don't know how to describe s3method in data.

我已将原因缩小到这些函数头:

#' @export
tabyl <- function(...) UseMethod("tabyl")

#' @inheritParams tabyl
#' @describeIn Create a frequency table from a vector, returned as a data.frame, showing percentages and with or without including \code{NA} values.  A fully-featured alternative to \code{table()}.
#' @export
tabyl.default <- function(vec, sort = FALSE, show_na = TRUE, ...) {
  ...
}

#' @inheritParams tabyl.default
#' @param .data a data.frame.
#' @param ... arguments passed to tabyl.default.
#' @describeIn tabyl Create a frequency table from a variable in a data.frame, returned as a data.frame, showing percentages and with or without including \code{NA} values.  A fully-featured alternative to \code{table()}.
#' @export
tabyl.data.frame <- function(.data, ...){
...
}

1 个答案:

答案 0 :(得分:2)

通用函数的名称必须介于describeIn和您的描述之间。你错过了。在上面的例子中,行:

#' @describeIn Create a frequency

应该是:

#' @describeIn tabyl Create a frequency