[Rd] bug in proj() (PR#13505)
rmh at temple.edu
rmh at temple.edu
Thu Feb 5 15:35:08 CET 2009
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
....
More information about the R-devel
mailing list