order_by_list | R Documentation |
order a given vector, which may contain duplicates, according to the wanted order given by some list
order_by_list(
given,
wanted,
incl.unordered = TRUE,
unordered.label = "Unlabelled"
)
order_as_list(
given,
wanted,
incl.unordered = TRUE,
unordered.label = "Unlabelled"
)
given |
the vector that needs ordering |
wanted |
the wanted order (list) |
incl.unordered |
should given elements not in wanted be kept? |
unordered.label |
label for the not-in-wanted elements |
list consisting of an index vector and a dataframe that connects the
sorted elements with the corresponding list names. Also, the elements of
rle
applied to list.names entry of the dataframe
g <- c("b", "d", "b", "f", "c", "c", "a")
w <- list(
"FOO" = c("a", "b"),
"BAR" = c("c"),
"BAZ" = c("e"),
"QUUZ" = c("d")
)
order_by_list(g, w)
order_by_list(g, w, incl.unordered = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.