[Rd] strange error with rw2010dev

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Apr 11 10:22:32 CEST 2005

On Mon, 11 Apr 2005, Martin Maechler wrote:

>>>>>> "PD" == Peter Dalgaard <p.dalgaard at biostat.ku.dk>
>>>>>>     on 11 Apr 2005 09:46:11 +0200 writes:
> .....
>     MM> Thanks again for the report; this should be fixable
>     MM> before release.
>    PD> Preferably before code freeze! (today)
>    PD> I think we (Thomas L.?) got it analysed once before: The
>    PD> issue is that summary.matrix is passing
>    PD> data.frame(object) back to summary.data.frame without
>    PD> removing the AsIs class.
>    PD> I don't a simple unclass() will do here.
> or, a bit more cautiously,
> summary.matrix <- function(object, ...)
>    summary.data.frame(data.frame(if(inherits(object,"AsIs")) unclass(object)
>    else object), ...)

I do not think that is correct.  You need either to remove the "AsIs" 
class and leave any other classes, or unclass all objects.
Otherwise adding an "AsIs" class will change the behaviour.

I would suggest that if you get to the summary.matrix method you want the 
summary as a matrix and so should always unclass, but that is debatable 
(think for example of an object of class c("mts", "ts"), which is a 
classed matrix, and there is an as.data.frame.ts method but no 

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