5

I have a package with a combination of S3 and S4 methods (yeah, I know, but try to write an S4 for sort(), as.matrix() and the likes...). So I stick with the classic roxygen2 from CRAN (version 2.2.2)

I've noticed that whatever I try, I can't get the usage tag in the Rd files get filled in automatically. I know I can do that by hand using @usage, but I want to keep it automated, as I have a rather extensive code base and I don't want to miss a tag somewhere by accident.

An example:

#' A small test function
#' 
#' This function tests roxygen2
#' @param x that's right, it's called x
#' @param ... some more stuff
#' 
#' @rdname testfun-methods
#' @aliases testfun
#' @docType methods
#' @export
setGeneric("testfun",function(x,...) standardGeneric("testfun"))

#' @rdname testfun-methods
#' @aliases testfun,matrix-method
#' @return the matrix minus 1
setMethod("testfun","matrix",function(x,...){x - 1})

#' @rdname testfun-methods
#' @aliases testfun,numeric-method
#' @return a vector plus 1
setMethod("testfun","matrix",function(x,...){x + 1})

If I wrap this in a package, roxygenize using roxygen2 (and RStudio, if that matters), and check the help file, it looks like this:

\docType{methods}
\name{testfun}
\alias{testfun}
\alias{testfun,matrix-method}
\alias{testfun,numeric-method}
\title{A small test function}
\arguments{
  \item{x}{that's right, it's called x}

  \item{...}{some more stuff}
}
\value{
  the matrix minus 1

  a vector plus 1
}
\description{
  This function tests roxygen2
}

No \usage section to be found...

BradleyDotNET
  • 57,599
  • 10
  • 90
  • 109
Joris Meys
  • 98,937
  • 27
  • 203
  • 258
  • Use the development version of roxygen2: `install_github("roxygen", "klutometis")`. It will also generate the correct aliases automatically. – hadley Nov 26 '13 at 21:57
  • Thanks for the link. edit : forgot about @include, problem solved. – Joris Meys Nov 27 '13 at 10:02

0 Answers0