Sort vector x based on order of vector y.
Arguments
- x
An atomic vector.
- y
An atomic vecotr.
Examples
#----------------------------------------------------------------------------
# sort_xy() examples.
#----------------------------------------------------------------------------
library(bkmisc)
sort_xy(c("z", "a", "b"), letters)
#> [1] "a" "b" "z"
sort_xy(3:1, 1:3)
#> [1] 1 2 3