From p.dalgaard at biostat.ku.dk  Mon Apr 11 10:16:21 2005
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Mon Apr 11 10:16:29 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: <x23btxd8yy.fsf@turmalin.kubism.ku.dk>

Martin Maechler <maechler@stat.math.ethz.ch> writes:

> >>>>> "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,

A "think" fell out in the above... Beware! I think you might want

cl <- class(object)
class(object) <- cl[cl != "AsIs"]

in case the object inherits from other classes. (Then again, it might
not be necessary, but better safe than sorry.)

> summary.matrix <- function(object, ...)
>     summary.data.frame(data.frame(if(inherits(object,"AsIs")) unclass(object)
>     else object), ...)
> 
> That does cure the problem in the Kjetil's example and the equivalent
> 
>  ## short 1-liner:
>  summary(df <- data.frame(mat = I(matrix(1:8, 2))))
> 
> 
> I'm currently make-checking the above.
> Martin
> 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] strange error with rw2010dev
Peter Dalgaard