[R] Merge vectors
Steve Lianoglou
mailinglist.honeypot at gmail.com
Wed Jul 22 23:06:42 CEST 2009
Hi,
On Jul 22, 2009, at 3:31 PM, MarcioRibeiro wrote:
>
> Hi listers,
> I would like to merge two vectors as follows...
> A<-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values
> B<-c(10,5,5,10,8,11,2,7,3,11,10) #random numbers (sample)
> I would like to set the vector of random numbers according to the
> order set
> of the vector of data values...
> The result would be: (130,43,43,130,98,230,5,91,7,230,130)
R> A[B]
[1] 130 43 43 130 98 230 5 91 7 230 130
-steve
--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list