Thomas Roth
2010-Jun-09 16:33 UTC
[Rd] Documenting generic S4 replacement method for package building
Dear List Members, I'm struggling with the documentation of a generic S4 replacement method. I've created a S4 method "lows" via setGeneric("lows", function(object) standardGeneric("lows")) setGeneric("lows<-", function(object, value) standardGeneric("lows<-")) setMethod("lows", "myClass", function(object) { listOut = vector(mode = "list") for(i in names(factors(object))) { listOut[i] = low(object at factors[[i]]) } return(listOut) } ) setReplaceMethod("lows", "myclass", function(object,value) { for(i in seq(along = object at factors)) { low(object at factors[[i]]) = value[i] } return(object) } ) As far as I understand "2.1.3 Documenting S4 classes and methods (Writing R-exts)" http://cran.r-project.org/doc/manuals/R-exts.html#Documenting-S4-classes-and -methods I need to call promptMethods(lows) After that an S4 replacement method is documented in the same way as an S3 one: see the description of \method in Documenting functions. That's where I get lost. The example gives me \usage{ \method{print}{ts}(x, calendar, \dots) } If I do (see below for the whole file) \usage{ \method{lows}{myClass}(object) } R CMD check myPackage gives me Undocumented code objects ... lows lows<- And Objects in \usage without \alias in documentation object "lows-methods": lows.myClass which is S3 syntax? The problem is probably trivial to somebody who has written a documentation file for an S4 replacement method but I'm stuck and tried many things, none of them working. Does somebody what needs to be added to the file? Thank you in advance Thomas Roth ------------------------- \name{lows-methods} \docType{methods} \alias{lows-methods} \alias{lows,facDesign-method} \title{Methods for Function lows in Package `myPackage'} \description{ Methods for function \code{lows} in Package `myPackage' } \section{Methods}{ \describe{ \item{\code{signature(object = "facDesign")}}{ %% ~~describe this method here~~ } }} \keyword{methods} \keyword{ ~~ other possible keyword(s) ~~ }