[Rd] listof

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jul 31 07:30:15 CEST 2014

On 30/07/2014 04:20, Adrian Baddeley wrote:
> Dear R developers
> A question about the class 'listof',  defined in package 'stats'.
> Other than its definition and use in the code for 'anova',

For alias.lm and aov in file aov.R, not anova.

> we can't see that the class 'listof' is used for anything else
> (in recommended packages, or elsewhere).
> In the spatstat package we have been using a 'listof'
> to represent a list of spatial objects of the same class
> (such as point patterns, or pixel images)
> and we've defined a plot method.
> Is it OK for us to hijack an existing class in this way,
> or is this a violation of some future plans/ design feature of R ?

The class is for lists to be printed in a certain way (there are other 
such classes, e.g. "simple.list", "DList") and for which coef() makes sense.

If your plot() method makes sense for all such lists (e.g. just calls 
plot() on each element) this seems fine: if not you need a more specific 
class inheriting from "listof".

The class has been in R 'for ever' and I do not see it being changed. 
I've added some notes to the source files about where it is used.

> We're about to publish a book on spatstat
> so I would much appreciate advice if we need to change it.
> regards
> Adrian
> Prof Adrian Baddeley FAA
> University of Western Australia

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