[Rd] Documenting generic S4 replacement method for package building

From: Thomas Roth <thomas.k.roth_at_googlemail.com>
Date: Wed, 09 Jun 2010 18:33:59 +0200


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) ~~ }



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 09 Jun 2010 - 16:36:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jun 2010 - 17:10:58 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive