sort_by_name | R Documentation |
Sort an object by its names
sort_by_name(x, decreasing = FALSE)
x |
An object with names. |
decreasing |
Logical. Should sort order be increasing or decreasing? |
x[sort(names(x), decreasing = decreasing)]
vec <- c(one = 1, two = 2, three = 3, four = 4)
sort_by_name(vec)
sort_by_name(vec, decreasing = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.