[Rd] Problem with proj

Simon Wotherspoon Simon.Wotherspoon at utas.edu.au
Fri May 20 05:18:43 CEST 2005

Hi all,
    Perhaps this in an inappropriate post, but I've found a bug in proj 
I'd like to track down a bit further before making a formal bug report.  
The example below shows the problem, if you change the rownames proj 
fails. The problem seems to be that there is a mismatch in the rownames 
in the qr objects constructed by aov and the rownames that proj is 
expecting them to have.  My question is - should I be trying to

1. correct the rownames of the qr object that aov makes, or is this 
likely to create other problems
2. change the way proj does its subsetting?

Or is this something that is likely to be quite tricky and better left 
to those that know?


## Example from help("proj")

N <- c(0,1,0,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0)
P <- c(1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0)
K <- c(1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1,0)
yield <- c(49.5,62.8,46.8,57.0,59.8,58.5,55.5,56.0,62.8,55.8,69.5,

npk <- data.frame(block=gl(6,4), N=factor(N), P=factor(P),
                  K=factor(K), yield=yield)
npk.aov <- aov(yield ~ block + N*P*K, npk)

## as a test, not particularly sensible
options(contrasts=c("contr.helmert", "contr.treatment"))
npk.aovE <- aov(yield ~  N*P*K + Error(block), npk)

## Change the rownames and it fails
rownames(npk) <- 2:25
npk.aovE <- aov(yield ~  N*P*K + Error(block), npk)

More information about the R-devel mailing list