[R-pkg-devel] Documenting S4 generic does not show usage

Manny Calavera olbapjose at gmail.com
Fri Mar 18 13:20:56 CET 2016


Good day to everyone,
I have an issue when documenting an S4 generic. I have the following in my
file generics.R:

#' @rdname myfunction-methods#' @name myfunction <- without this,
roxygen2 complaints about missing name#' @export
methods::setGeneric("myfunction",
  function( arg1, arg2 ),
      arg3, arg4 {
        methods::standardGeneric("myfunction")});

and then in my file mymethods.R:

#' Something#'#' A brief description#'#' @param all params... #'
@return Something#' @name myfunction <- without this, roxygen2
complaints on missing name#' @include generics.R#' @rdname
myfunction-methods#' @export
methods::setMethod( "myfunction",
  methods::signature( arg1 = "formula", arg2 = "data.frame" ),
  function( arg1, arg2, arg3, arg4 ) {

   ...whatever
    })

With this, everything is fine except that the usage section is not showing
up. Could you please correct what is wrong in my documentation? More
precisely:

   1.

   Is it correct to write the documentation before setMethod or is it
   preferably before setGeneric ?
   2.

   Why do I need the @namein both files? Should it be different? Does it
   matter?
   3.

   Do I need @export in both files?
   4.

   Would @alias help at all?

I tried reading Hadley Wickham's section on how to document S4 functions
but did not help (probably I didn't understand something correctly).

Thank you very much in advance.

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list