[R] Proper way to document print( ) functions
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Thu Mar 6 22:41:29 CET 2003
The simplest way is to define the method correctly, as print.myclass(x,
myarg, ...). That message is about the code, not the documentation, but
you will get a different one if the code and documentation disagree.
All print methods must include `...', and there is a section in `Writing R
Extensions' on why. In brief, I should be able to define class
`richerclass' inheriting from `myclass' and have a print method for
`richerclass' with different arguments that calls NextMethod("print").
BTW this applies equally to S-PLUS.
On Thu, 6 Mar 2003, Frank E Harrell Jr wrote:
> Frequently we have a print method, say print.myclass, that has a variety of arguments. If in the .Rd file I say
>
> \usage{
> \method{print}{myclass}(x, myarg)
> }
>
> I get a warning when running R CMD chk:
>
> * checking generic/method consistency ... WARNING
> print:
> function(x, ...)
> print.myclass:
> function(x, myarg)
>
> What is the proper way to handle this?
>
> Thanks
>
--
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-help
mailing list