Hi,

Is it possible to use x and y below to produce the vector shown in
desired.result (which represents the values in y ordered according to
the order specified by x)? Ideally the solution must be efficient in
terms of timing as I'm dealing with *very* long vectors.


x <- c(7, 6, 5, 9, 4, 14, 8, 12, 10, 11, 2, 13, 3, 1)
y <- c(1, 2, 9, 8, 11)
desired.result <- c(9, 8, 11, 2, 1)

Thanks,
Lars.

______________________________________________
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