Learn R Programming

stringr (version 1.1.0)

str_order: Order or sort a character vector.

Description

Order or sort a character vector.

Usage

str_order(x, decreasing = FALSE, na_last = TRUE, locale = "", ...)
str_sort(x, decreasing = FALSE, na_last = TRUE, locale = "", ...)

Arguments

x
A character vector to sort.
decreasing
A boolean. If FALSE, the default, sorts from lowest to highest; if TRUE sorts from highest to lowest.
na_last
Where should NA go? TRUE at the end, FALSE at the beginning, NA dropped.
locale
In which locale should the sorting occur? Defaults to the current locale.
...
Other options used to control sorting order. Passed on to stri_opts_collator.

See Also

stri_order for the underlying implementation.

Examples

Run this code
str_order(letters, locale = "en")
str_sort(letters, locale = "en")

str_order(letters, locale = "haw")
str_sort(letters, locale = "haw")

Run the code above in your browser using DataLab