stri_order(str, decreasing = FALSE, na_last = TRUE, ..., opts_collator = NULL)
stri_sort(str, decreasing = FALSE, na_last = NA, ..., opts_collator = NULL)
FALSE
, default)
or nonincreasing (TRUE
)?NA
s
in str
. If TRUE
, then missing values in str
are put
at the end; if FALSE
, they are put at the beginning;
if NA
, then they are removed from the output.opts_collator
stri_opts_collator
, NULL
for default collation optionsstri_order
, an integer vector that gives the sort order
is returned.For stri_order
, you get a sorted version of str
,
i.e. a character vector.
stri_opts_collator
.These functions use a stable sort algorithm (STL's stable_sort),
which performs up to $N*log^2(N)$ element comparisons,
where $N$ is the length of str
.
Interestingly, our benchmarks indicate that stri_order
is most often faster that R's order
.
%s<%< a="">%<>
,
stri_compare
,
stri_count_boundaries
,
stri_duplicated
,
stri_enc_detect2
,
stri_extract_all_boundaries
,
stri_locate_all_boundaries
,
stri_opts_collator
,
stri_split_boundaries
,
stri_trans_tolower
,
stri_unique
, stri_wrap
,
stringi-locale
,
stringi-search-boundaries
,
stringi-search-coll
stri_sort(c("hladny", "chladny"), locale="pl_PL")
stri_sort(c("hladny", "chladny"), locale="sk_SK")
Run the code above in your browser using DataCamp Workspace