This is definitely the best way:
c(lapply(1:length(x), function(i, x, y) c(x[i], y[i]), x, y),
recursive=TRUE)
JS
---
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Shubha Vishwanath Karanth
Sent: 23 July 2008 13:55
To: [EMAIL PROTECTED]
Subject: [R] Simple... but...
Hi R,
If
x=c(1,3,5)
y=c(2,4,6)
I need a vector which is c(1,2,3,4,5,6) from x and y.
How do I do it? I mean the best way....
Thanks, Shubha
This e-mail may contain confidential and/or privileged
i...{{dropped:13}}
______________________________________________
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.
______________________________________________
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.