On Feb 25, 2009, at 12:12 AM, David Winsemius wrote:
On Feb 24, 2009, at 11:36 PM, Fuchs Ira wrote:
also unrelated: if I have two vectors and I want to combine them
to form a matrix ,is cbind (or rbind) the most direct way to do this?
e.g.
x=c(1,2,3)
y=c(3,4,5)
z=rbind(x,y)
That is ok. Also effective would be:
z <- matrix( c(x,y), ncol=length(x) )
Would need byrow=TRUE for that to behave as desired.
> z <- matrix(c(x,y), 2.3, byrow=TRUE)
> z
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 3 4 5
--
David Winsemius
______________________________________________
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.