From ripley at stats.ox.ac.uk  Mon Apr 11 10:22:32 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon Apr 11 10:22:40 2005
Subject: [Rd] strange error with rw2010dev
In-Reply-To: <16986.12381.797445.890227@stat.math.ethz.ch>
References: <4248AC1A.3020104@acelerate.com> <425969D4.9020105@acelerate.com>
	<16986.8155.624235.787171@stat.math.ethz.ch>
	<x2fyxxdad8.fsf@turmalin.kubism.ku.dk>
	<16986.12381.797445.890227@stat.math.ethz.ch>
Message-ID: <Pine.LNX.4.61.0504110915220.30969@gannet.stats>

On Mon, 11 Apr 2005, Martin Maechler wrote:

>>>>>> "PD" == Peter Dalgaard <p.dalgaard@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 
summary.ts).

-- 
Brian D. Ripley,                  ripley@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


[Rd] strange error with rw2010dev
Prof Brian Ripley