fct_prefix | R Documentation |
Prefix something whilst preserving original sort order
fct_prefix(x, prefix)
x |
numeric, string, etc. |
prefix |
string |
a factor that sorts in the same order as x
FIXME: move to more appropriate home (package)
x <- c(33, 156, 44)
prefixed <- fct_prefix(x, prefix = "#")
sort(prefixed)
sort(str_c("#", x)) # not the same
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.