On Wed, Jul 23, 2008 at 3:23 PM, Doran, Harold <[EMAIL PROTECTED]> wrote:
> Shubba
>
> I'm confused. Your first post said the result should be c(1,2,3,4,5,6)
> when x and y are combined. The code I sent does that. But here you say
> your result should be c(4,1,2,5,2,3).
>
> What do you want your result to actually be?
>
>> -----Original Message-----
>> From: Shubha Vishwanath Karanth [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, July 23, 2008 9:17 AM
>> To: Doran, Harold; [EMAIL PROTECTED]
>> Subject: RE: [R] Simple... but...
>>
>> OK,
>>
>> Let x=c(4,2,2)
>>       y=c(1,5,3)
>>
>> My result should be c(4,1,2,5,2,3)
>>
>> Thanks, Shubha
>>



There should be nicer ways, but this does it:

x<-c(4,2,2)
y<-c(1,5,3)
c(matrix(c(x,y),byrow=T,nrow=2))


/Gustaf
-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik

______________________________________________
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