Is this the kind of thing you are talking about? ### 8< cut here 8< ### A <- rep(NA, 100) B <- sort(runif(25)) C <- sort(sample(1:100, 25))
A[C] <- B B C A ### 8< cut here 8< ### (The sorting is not necessary. It's only there to make checking what happened easier.) -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Gregory Ryslik Sent: Sunday, 12 September 2010 8:54 AM To: [email protected] Subject: [R] mapping array Hi, Suppose I have array A with 100 elements all filled in with "N/A". Array B has 25 elements with actual values. Lastly, I have array C that provides a map of where to put the elements from array A into array B. Thus C would say put element 1 from B into element 3 from array A. I realize I can do this with a for loop. However, because I'm doing a random forest with this, I'd like to avoid a for loop because it would take significantly more time. Thanks, Greg ______________________________________________ [email protected] 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. ______________________________________________ [email protected] 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.

