From thomas.k.roth at googlemail.com  Wed Jun  9 18:33:59 2010
From: thomas.k.roth at googlemail.com (Thomas Roth)
Date: Wed, 9 Jun 2010 18:33:59 +0200
Subject: [Rd] Documenting generic S4 replacement method for package building
Message-ID: <4c0fc27c.0eafcc0a.7ab2.ffffbeeb@mx.google.com>

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



[Rd] Documenting generic S4 replacement method for package building
Thomas Roth