sort_length {quickcode} | R Documentation |
Sort the length of the content of a vector
sort_length(vec, asc = TRUE)
vec |
a vector |
asc |
TRUE or FALSE whether to sort by ascending or descending order |
vector of items sorted by length
This function removes all NAs prior to sorting the vector
# sort by length of content
x = c("acs","tt","jdssr","h","grab")
sort_length(vec = x) # ascending order of length
sort_length(vec = x, asc = FALSE) # descending order of length