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

______________________________________________
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