[R] Simple... but...

Gustaf Rydevik gustaf.rydevik at gmail.com
Wed Jul 23 15:58:29 CEST 2008


On Wed, Jul 23, 2008 at 3:23 PM, Doran, Harold <HDoran at air.org> 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:shubhak at ambaresearch.com]
>> Sent: Wednesday, July 23, 2008 9:17 AM
>> To: Doran, Harold; r-help at stat.math.ethz.ch
>> 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



More information about the R-help mailing list