[Rd] bug in proj() (PR#13505)

From: <rmh_at_temple.edu>
Date: Thu, 05 Feb 2009 15:35:08 +0100 (CET)


The result of proj() is not currently coerced to data.frame when requested. I use this capability pedagogically all the time. It did work when I wrote proj() for the Chambers and Hastie book, and it still works in S-Plus. A minimal repair is in the as.data.frame.aovproj definition below.

Rich

> version

               _                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          8.1                         
year           2008                        
month          12                          
day            22                          
svn rev        47281                       
language       R                           
version.string R version 2.8.1 (2008-12-22)
>

## using the example in ?aov

utils::data(npk, package="MASS")

npk.aov <- aov(yield ~ block + N * P + K, npk) proj(npk.aov)
cbind(npk, proj(npk.aov))

as.data.frame.aovproj <- function(x, ...) as.data.frame(unclass(x), ...)

cbind(npk, proj(npk.aov))

> cbind(npk, proj(npk.aov))

Error in as.data.frame.default(x[[i]], optional = TRUE) :   cannot coerce class "aovproj" into a data.frame
> as.data.frame.aovproj <- function(x, ...) as.data.frame(unclass(x), ...)
> cbind(npk, proj(npk.aov))

   block N P K yield (Intercept)  block         N          P         K
1      1 0 1 1  49.5      54.875 -0.850 -2.808333 -0.5916667 -1.991667
....

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 05 Feb 2009 - 14:40:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 Feb 2009 - 15:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive