Description Usage Arguments Details Value See Also Examples
stri_order determines a permutation which rearranges strings into ascending or descending order. stri_sort sorts the vector according to a lexicographic order.
1 2 3 |
str |
character vector |
decreasing |
single logical value; should the sort
order be nondecreasing ( |
opts_collator |
a named list as generated with
|
For more information on ICU's Collator and how to
tune it up in stringi, refer to
stri_opts_collator.
Uses a stable sort algorithm (STL's stable_sort);
performs up to N*log^2(N) element comparisons, where
N is the length of str.
Interestingly, stri_order is most often faster that
R's order.
Missing values are always put at the end of a character vector.
stri_sort is a 'black sheep' in stringi: it
does not always return UTF-8-encoded strings. Moreover, it
preserves many input object's attributes. This is because
it is defined as str[stri_order(str, decreasing,
opts_collator)].
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.
Other locale_sensitive: stri_cmp,
stri_compare; stri_count_fixed;
stri_detect_fixed;
stri_enc_detect2;
stri_locate_all_fixed,
stri_locate_all_fixed,,
stri_locate_first_fixed,
stri_locate_first_fixed,,
stri_locate_last_fixed,
stri_locate_last_fixed;
stri_opts_collator;
stri_replace_all_fixed,
stri_replace_all_fixed,
stri_replace_first_fixed,
stri_replace_first_fixed,
stri_replace_last_fixed,
stri_replace_last_fixed;
stri_split_fixed,
stri_split_fixed;
stri_trans_tolower,
stri_trans_totitle,
stri_trans_toupper;
stringi-locale;
stringi-search-fixed
1 2 3 4 5 | ## Not run:
stri_sort(c("hladny", "chladny"), opts_collator=stri_opts_collator(locale="pl_PL"))
stri_sort(c("hladny", "chladny"), opts_collator=stri_opts_collator(locale="sk_SK"))
## End(Not run)
|
[1] "chladny" "hladny"
[1] "hladny" "chladny"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.