S3 method help (roxygen2) S3 method help (roxygen2) r r

S3 method help (roxygen2)


The bug you are seeing is mostly likely caused because the list method of the common generic is not being exported, so common.default gets called instead. You can pick up this problem using devtools::missing_s3 - the function is a bit heuristic, so you may get a few false positives (e.g. it can't currently tell that is.list isn't a method). This is an incredibly common problem (it has caught me so many times), and the next iteration of roxygen will do more to prevent it.

Currently, to correctly export S3 methods with roxygen you need to do either:

  • @S3method generic class (and nothing else) if you don't want to document the method
  • @method generic class and @export if you want to export and document it.

You should never have @S3method and @method in the same documentation block.

Update for roxygen2 >3.0.0

Now roxygen automatically figures out if a function is an S3 method so:

  • Never use @S3method or @method
  • Use @export if you want the method to be exported (which you normally do, even if the generic isn't)