Description Usage Arguments Value Examples
View source: R/ShortFunctions.R
Sort a character vector by the lengths of its elements
1 | SortLength(x, decreasing = TRUE, na.last = NA)
|
x |
a character vector |
decreasing |
logical vector of length 1 indicating whether to keep NA elements. Defaults to TRUE |
na.last |
for controlling the treatment of NAs. If TRUE, missing values in the data are put last; if FALSE, they are put first; if NA, they are removed. |
A vector containing the elements of x
sorted by length
1 2 3 4 5 6 7 8 9 10 | ex1 = c("Green", "Tech", "High", "Charter", "School")
ex2 = c(NA, NA, NA, "1 2 3", "6", "591", "A ")
SortLength(ex1)
SortLength(ex1, F)
SortLength(ex2)
SortLength(ex2, F)
SortLength(ex2, na.last = T)
SortLength(ex2, na.last = F)
SortLength(ex2, F, na.last = T)
SortLength(ex2, F, na.last = F)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.