Sort a vector by alphabetic or numeric order
Arguments
- x
the vector to be sorted
- desc
logical; if set to true, will return a vector sorted in descending order
Examples
# create a character vector
myvec <- c("dog", "cat", "bird")
# arrange vector by character
arrange_vector(myvec)
#> [1] "bird" "cat" "dog"
# can also arrange in reverse order
arrange_vector(myvec, desc = TRUE)
#> [1] "dog" "cat" "bird"