well your out6<- matrix(NA,3,2) has 2 cols, so no chance R will let you fill
something into a 3rd column as in out6[i, 3] <-
different portion of the data, we get an error:
out6<- matrix(NA,3,2)
out6[,1] <- c(103,105,107)
varnames <- colnames(plomin)
rownames(out6) <- varnames[out6[,1]]
for ( i in 1:3){ # Calculate teacher assessment correlations for MZ
twins at
10
+ out6[i,3] <- cor(mat.cmz3[,2*(51+i)],
mat.cmz3[,2*(50+i)+1],use="complete")
+ }
Error in out6[i, 3] <- cor(mat.cmz3[, 2 * (51 + i)], mat.cmz3[, 2 * (50
+ :
subscript out of bounds
+ out6
We've tried rewriting the code in that line in many different ways,
such
that the elements are reordered, we've written it from scratch, we've
taken
out all the spaces and we can't seem to get it to read beyond that '+'
sign
in that line. Does anyone have any clue as to why we would get the
error in
one but not the other?
Thanks.
Best,
Jill & Jeremy
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l