order_as | R Documentation |
order a given vector, which may contain duplicates, according to the wanted order given by some other vector
order_as(given, wanted, incl.unordered = TRUE)
given |
the vector that needs ordering |
wanted |
the wanted order |
incl.unordered |
should given elements not in wanted be kept? |
an index vector
g <- c("b", "d", "b", "f", "c", "c", "a")
order_as(given = g, wanted = letters[1:4])
g[order_as(given = g, wanted = letters[1:4])]
g[order_as(given = g, wanted = letters[1:4], incl.unordered = FALSE)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.