title: Automatically document all methods of an S4 generic, using roxygen2
body: <p>I am writing an <a href="/questions/tagged/r" class="post-tag" title="show questions tagged &#39;r&#39;" rel="tag">r</a> package using <a href="/questions/tagged/roxygen2" class="post-tag" title="show questions tagged &#39;roxygen2&#39;" rel="tag">roxygen2</a> for the documentation. I am having some trouble documenting S4 methods. I have defined a generic <a href="/questions/tagged/s4" class="post-tag" title="show questions tagged &#39;s4&#39;" rel="tag">s4</a> method (e.g. <code>myGeneric</code>) and few methods that implement it.</p>
  
  <p><strong>Question</strong>: Is there a way to automatically document all methods of a generic?</p>
  
  <p>The manual solution is to add these two lines for each method (this would be for the first method in my dummy example):</p>
  
  <pre><code>##' @rdname myGeneric-methods
  ##' @aliases myGeneric,numeric,numeric,missing-method
  </code></pre>
  
  <p>Since I use a lot of methods, I have to add a lot to satisfy the R CMD check.</p>
  
  <hr>
  
  <p>I read in Hadley's Advanced R about documenting S4 methods <a href="http://adv-r.had.co.nz/Documenting-functions.html">here</a> that one can use @genericMethods:</p>
  
  <blockquote>
    <p>Use @genericMethods in the generic documentation if you want an automated listing of all methods implemented for the generic. </p>
  </blockquote>
  
  <p>I think this is not implemented in <code>roxygen2</code>, or implemented under another name. The only thing I found about the <code>@genericMethods</code> tag was in the roxygen3 github <a href="https://github.com/hadley/roxygen3/blob/2650b68a71b75efa05dec4402256f6afc71a622b/R/tag-generic-methods.r">here</a>, which was discontinued(?).</p>
  
  <hr>
  
  <p>Just a dummy example, where I document only the generic and want all the implemented methods automatically listed:</p>
  
  <pre><code>##' @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
  ##' @docType methods
  ##' @export 
  setGeneric("myGeneric", function(object, data, FUN, ...)
             {standardGeneric ("myGeneric")} )
  
  setMethod("myGeneric", c("numeric", "numeric", "missing"),
            function(object, data,...) { 
                myGeneric(object, data, sum,...) 
            })
  setMethod("myGeneric", c("numeric", "data.frame", "missing"),
            function(object, data,...) { 
                myGeneric(object, as.vector(unlist(data), sum,...) 
            })
  setMethod("myGeneric", c("numeric", "numeric", "function"),
            function(object, data, FUN,...) {
               ## Do something
            })
  </code></pre>
  
  <p>Any help will be really appreciated,</p>
  
  <p>alex</p>