[R] Merge two vectors into one
David Winsemius
dwinsemius at comcast.net
Sun Mar 23 20:37:23 CET 2014
On Mar 22, 2014, at 3:22 PM, Tham Tran wrote:
> Dear R users,
>
> Given two vectors x and y
> a=1 2 3
> b=4 5 6
>
> i want to combine them into a single vector z as 1 4 2 5 3 6
One way:
c( matrix(c(a,b), nrow=2, byrow=TRUE) )
Leaving in the usual footer because Nabble's interface usually omits this and Nabble users often fail to read it.
################
R-help at 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.
--
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list