sort_length | R Documentation |
Sort the length or file types of the content of a vector
Takes a vector of file names and sorts them by their file extensions (file type)
sort_length(vec, asc = TRUE)
sort_file_type(files, asc = TRUE)
vec |
a vector |
asc |
A logical value indicating whether to sort in ascending (TRUE) or descending (FALSE) order. Default is TRUE. |
files |
A character vector containing file names to be sorted |
vector of items sorted by length
A character vector of sorted file names
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
files <- c("doc1.pdf",
"image.jpg", "house.csv", "notes.txt",
"patab","doc2.pdf", "data.csv", "pic.png","cotab")
sort_file_type(files)
sort_file_type(files, asc = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.