[Rd] how do I write Rd file for this?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Oct 5 18:57:21 CEST 2005


On Wed, 5 Oct 2005, Liaw, Andy wrote:

> Dear R-devel,
>
> I'm working on Prof. Loader's new version of locfit to try to get it
> pass R CMD check.  I'm almost there, but I have a problem with some Rd
> files that I hope some one can help me resolve.  Here's an example:
>
> In the package there's a function called locfit.censor().  This function
> can be used in a few different ways:
>
> locfit.censor(x, y, cens, ...)
> locfit.censor(formula, ...)

I don't think so (you cannot give named arguments like that?).  What does 
args(locfit.censor) give?

Do you mean that x can be a vector or a formula, and y and cens are 
ignored if x is a formula?  If so that is what you need to say.  E.g.

\usage{
locfit.censor(x, y, cens, \dots)
}
\arguments{
   \item{x}{a vector or a formula ...}
   \item{y, cens}{.... Ignored if \code{x} is a formula.}
   \item{\dots}{....}
}

> locfit(formula, ..., lfproc=locfit.censor)

That's calling another function, locfit,  which presumably you have 
documented elsewhere.

BTW, \synopsis is likely to be deprecated for 2.3.0, so you don't want to 
start using it for new help files now.


> What I did in locfit.censor.Rd is have something like:
>
> \synopsis{
> locfit.censor(x, y, cens, ..., iter=3, km=FALSE)
> }
> \usage{
> locfit(formula, cens=cens, lfproc=locfit.censor)
> locfit.censor(formula, cens, ..., iter=3, km=FALSE)
> }
>
> However, R CMD check gives me:
>
> Undocumented arguments in documentation object 'locfit.censor'
>  formula lfproc
> Documented arguments not in \usage in documentation object
> 'locfit.censor':
>  x y
> Objects in \usage without \alias in documentation object
> 'locfit.censor':
>  locfit
>
> Can some one tell me what would be the preferred way of fixing this?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list