stri_order {stringi} | R Documentation |
stri_order determines a permutation which rearranges strings into an ascending or descending order. stri_sort sorts the vector according to a lexicographic order.
stri_order(str, decreasing = FALSE, na_last = TRUE, ..., opts_collator = NULL) stri_sort(str, decreasing = FALSE, na_last = NA, ..., opts_collator = NULL)
str |
a character vector |
decreasing |
a single logical value; should the sort order
be nondecreasing ( |
na_last |
a single logical value; controls the treatment of |
... |
additional settings for |
opts_collator |
a named list with ICU Collator's options
as generated with |
For more information on ICU's Collator and how to tune it up
in stringi, refer to 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
.
For stri_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.
Collation - ICU User Guide, http://userguide.icu-project.org/collation
Other locale_sensitive: %s!==%
,
%s!=%
, %s<=%
,
%s<%
, %s===%
,
%s==%
, %s>=%
,
%s>%
, %stri!==%
,
%stri!=%
, %stri<=%
,
%stri<%
, %stri===%
,
%stri==%
, %stri>=%
,
%stri>%
; stri_cmp
,
stri_cmp_eq
, stri_cmp_equiv
,
stri_cmp_ge
, stri_cmp_gt
,
stri_cmp_le
, stri_cmp_lt
,
stri_cmp_neq
,
stri_cmp_nequiv
,
stri_compare
;
stri_count_boundaries
,
stri_count_words
;
stri_duplicated
,
stri_duplicated_any
;
stri_enc_detect2
;
stri_extract_all_boundaries
,
stri_extract_all_words
,
stri_extract_first_boundaries
,
stri_extract_first_words
,
stri_extract_last_boundaries
,
stri_extract_last_words
;
stri_locate_all_boundaries
,
stri_locate_all_words
,
stri_locate_first_boundaries
,
stri_locate_first_words
,
stri_locate_last_boundaries
,
stri_locate_last_words
;
stri_opts_collator
;
stri_split_boundaries
;
stri_trans_tolower
,
stri_trans_totitle
,
stri_trans_toupper
;
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")