[Roxygen-devel] @export tag doesn't work with S4 methods for use.Rd2=TRUE

Manuel J. A. Eugster Manuel.Eugster at stat.uni-muenchen.de
Thu Oct 14 07:47:33 CEST 2010


> Reporting yet another issue with S4 in roxygen.  It appears that the
> @export tag does not work when use.Rd2=TRUE:

You have to use the @exportMethod tag to export S4 methods or generics.

See the useR 2010 tutorial at http://roxygen.org/useR/, part 1 for an
example how to export S4 methods, etc.


Manuel.



> ##' Inference for fitted model objects.
> ##'
> ##' Extract point estimates, standard errors, confidence intervals,
> ##' p-values, and sample size.
> ##' @rdname infer,-methods
> ##' @aliases infer infer,-method infer,lm-method infer,glm-method
> ##' @docType methods
> ##' @usage infer(fitobj, vars=NULL, robust.se=TRUE, two.sided=TRUE
> ##' , ci.level=0.95)
> ##' @param fitobj Fitted model object, such as those of class \code{lm}.
> ##' @param vars Vector of variable names to obtain inference information
> ##' for.  Defaults to \code{NULL} which corresponds to all variables
> ##' in the fitted model.
> ##' @param robust.se Boolean indicator for whether robust standard
> ##' errors should be use.  Defaults to \code{TRUE}.
> ##' @param two.sided Boolean indicator for whether p-values should
> ##' correspond to a two-sided test or one-sided.  Defaults to
> ##' \code{TRUE}.
> ##' @param ci.level Confidence level.  Defaults to 0.95.
> ##' @param ... Not used.
> ##' @return S4 \code{inference} object.
> ##' @examples
> ##' infer(lm(rnorm(100) ~ runif(100)))
> ##' @export
> ##' @author Vinh Nguyen
> setGeneric("infer", function(fitobj, ...) standardGeneric("infer"))
>
> export(infer) does not get placed in NAMESPACE.  It does work for the
> following example:
>
> ##' hello
> ##'
> ##' hello
> ##' @title hello
> ##' @param x
> ##' @return what
> ##' @author Vinh Nguyen
> ##' @export
> hello<- function(x){
> x
> }
>
> This presents an issue in that written examples won't run and pass "R
> CMD check".  We can manually place it in NAMESPACE ourselves, but the
> roxygen parser removes it whenever roxygen is ran.
>
> Vinh
> --
> Vinh Nguyen
> Department of Statistics
> Donald Bren School of ICS
> 2231 Bren Hall
> University of California, Irvine
> Irvine, CA 92607
> vqnguyen at uci.edu | http://www.ics.uci.edu/~vqnguyen/
> Schedule a meeting: http://tungle.me/VinhNguyen
> _______________________________________________
> Roxygen-devel mailing list
> Roxygen-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/roxygen-devel


More information about the Roxygen-devel mailing list