Hello.
 I am working with a set of variables which are in columns. Three of them
are of the same length while one has a different length. Typing
'>data<-matrix(c(ca$value, mo$value,b2$value, y1), ncol = 3)'
appears to read any three columns out of the four, though I can say exactly
which of these three columns are read.
However, typing '> data<-matrix(c(ca$value, mo$value,b2$value, y1), ncol =
4)' gives the warning message below:
'Warning message:
In matrix(c(ca$value, mo$value, b2$value, y1), ncol = 4) :
  data length [26637] is not a sub-multiple or multiple of the number of
rows [6660]'
Since y1 is the variable that has a different length, I dropped and used
ncol = 3 and there was no error message. In order to be convinced that the
error message is due to the difference in length of y1, I included y1 and
dropped b2$value. There was no error message still, confusing me as to where
the error arises when I tried to use ncol = 4.

This implies that the matrix will accept any three column variables no
matter the length, but once it is 4 variables in which case I think I should
change ncol = 3 to ncol = 4 to reflect the number of columns. And I also
intend to increase the number of these columns to about 10. Should I not be
using ncol = n where n stands for the number of the columns I have in my
matrix?

Any advice would be highly appreciated. Thanks
Ogbos

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to