# x subset of y
x = c("b", "a", "c", "d")
y = letters
x[reorder_vector(x, y)]
# y subset of x
y = letters[1:3]
x[reorder_vector(x, y)]
x[reorder_vector(x, y, na_last = TRUE)]
x[reorder_vector(x, y, na_last = FALSE)]
Run the code above in your browser using DataLab