Sam Firke
Sam Firke

Reputation: 23004

roxygen2 error "Error: Don't know how to describe s3method in data."

When I try to devtools::document() my R package, I get the result:

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

I've narrowed the cause down to these function headers:

#' @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, ...){
...
}

Upvotes: 2

Views: 349

Answers (1)

Sam Firke
Sam Firke

Reputation: 23004

The name of the generic function must go between describeIn and your description. You're missing it. In the above example, the line:

#' @describeIn Create a frequency

Should be:

#' @describeIn tabyl Create a frequency

Upvotes: 2

Related Questions