View source: R/reorder_vector.R
reorder_vector | R Documentation |
Returns an integer vector to order vector x
according to vector y
.
reorder_vector(x, y, na_last = NA)
x |
( |
y |
( |
na_last |
(
|
(integer()
).
# 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)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.