EVOLUTION-MANAGER
Edit File: stri_sort.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Sorting</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for stri_sort {stringi}"><tr><td>stri_sort {stringi}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Sorting</h2> <h3>Description</h3> <p>The function sorts a character vector according to the locale-dependent lexicographic order. </p> <h3>Usage</h3> <pre> stri_sort(str, decreasing = FALSE, na_last = NA, ..., opts_collator = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>str</code></td> <td> <p>a character vector</p> </td></tr> <tr valign="top"><td><code>decreasing</code></td> <td> <p>a single logical value; should the sort order be nondecreasing (<code>FALSE</code>, default, i.e., weakly increasing) or nonincreasing (<code>TRUE</code>)?</p> </td></tr> <tr valign="top"><td><code>na_last</code></td> <td> <p>a single logical value; controls the treatment of <code>NA</code>s in <code>str</code>. If <code>TRUE</code>, then missing values in <code>str</code> are put at the end; if <code>FALSE</code>, they are put at the beginning; if <code>NA</code>, then they are removed from the output</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>additional settings for <code>opts_collator</code></p> </td></tr> <tr valign="top"><td><code>opts_collator</code></td> <td> <p>a named list with <span class="pkg">ICU</span> Collator's options, see <code><a href="stri_opts_collator.html">stri_opts_collator</a></code>, <code>NULL</code> for default collation options</p> </td></tr> </table> <h3>Details</h3> <p>For more information on <span class="pkg">ICU</span>'s Collator and how to tune it up in <span class="pkg">stringi</span>, refer to <code><a href="stri_opts_collator.html">stri_opts_collator</a></code>. </p> <p>As usual in <span class="pkg">stringi</span>, non-character inputs are coerced to strings, see an example below for a perhaps non-intitive behavior of lexicographic sorting on numeric inputs. </p> <p>This function uses a stable sort algorithm (<span class="pkg">STL</span>'s <code>stable_sort</code>), which performs up to <i>N*log^2(N)</i> element comparisons, where <i>N</i> is the length of <code>str</code>. </p> <h3>Value</h3> <p>The result is a sorted version of <code>str</code>, i.e., a character vector. </p> <h3>References</h3> <p><em>Collation</em> - ICU User Guide, <a href="http://userguide.icu-project.org/collation">http://userguide.icu-project.org/collation</a> </p> <h3>See Also</h3> <p>Other locale_sensitive: <code><a href="oper_comparison.html">%s<%</a>()</code>, <code><a href="stri_compare.html">stri_compare</a>()</code>, <code><a href="stri_count_boundaries.html">stri_count_boundaries</a>()</code>, <code><a href="stri_duplicated.html">stri_duplicated</a>()</code>, <code><a href="stri_enc_detect2.html">stri_enc_detect2</a>()</code>, <code><a href="stri_extract_boundaries.html">stri_extract_all_boundaries</a>()</code>, <code><a href="stri_locate_boundaries.html">stri_locate_all_boundaries</a>()</code>, <code><a href="stri_opts_collator.html">stri_opts_collator</a>()</code>, <code><a href="stri_order.html">stri_order</a>()</code>, <code><a href="stri_split_boundaries.html">stri_split_boundaries</a>()</code>, <code><a href="stri_trans_casemap.html">stri_trans_tolower</a>()</code>, <code><a href="stri_unique.html">stri_unique</a>()</code>, <code><a href="stri_wrap.html">stri_wrap</a>()</code>, <code><a href="stringi-locale.html">stringi-locale</a></code>, <code><a href="stringi-search-boundaries.html">stringi-search-boundaries</a></code>, <code><a href="stringi-search-coll.html">stringi-search-coll</a></code> </p> <h3>Examples</h3> <pre> stri_sort(c("hladny", "chladny"), locale="pl_PL") stri_sort(c("hladny", "chladny"), locale="sk_SK") stri_sort(sample(LETTERS)) stri_sort(c(1, 100, 2, 101, 11, 10)) stri_sort(c(1, 100, 2, 101, 11, 10), numeric=TRUE) </pre> <hr /><div style="text-align: center;">[Package <em>stringi</em> version 1.4.6 <a href="00Index.html">Index</a>]</div> </body></html>