[R] Cannot grasp how to apply "by" here...

Charilaos Skiadas cskiadas at gmail.com
Mon Dec 17 20:02:40 CET 2007


On Dec 17, 2007, at 1:47 PM, Jonas Malmros wrote:

> factor.names <- c("Factor1", "Factor2")
> factor.pvalue <- c("SigF1", "SigF2")
> results <- numeric()
> vector <- matrix(0, ncol=(length(factor.names)*2+2), nrow=1)
> colnames(vector) <- c("No.obs", factor.names, factor.pvalue)

If you look at "vector" you'll see it has column dimension 6. You are  
trying to assign to it 5 colnames, which is not going to work. That's  
exactly what the error tells you, and it happens on the line above,  
the rest of your code is irrelevant to it.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College



More information about the R-help mailing list