EVOLUTION-MANAGER
Edit File: stri_duplicated.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: Determine Duplicated Elements</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_duplicated {stringi}"><tr><td>stri_duplicated {stringi}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Determine Duplicated Elements</h2> <h3>Description</h3> <p><code>stri_duplicated()</code> determines which strings in a character vector are duplicates of other elements. </p> <p><code>stri_duplicated_any()</code> determines if there are any duplicated strings in a character vector. </p> <h3>Usage</h3> <pre> stri_duplicated(str, fromLast = FALSE, ..., opts_collator = NULL) stri_duplicated_any(str, fromLast = FALSE, ..., 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>fromLast</code></td> <td> <p>a single logical value; indicates whether search should be performed from the last to the first string</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>Missing values are regarded as equal. </p> <p>Unlike <code><a href="../../base/html/duplicated.html">duplicated</a></code> and <code><a href="../../base/html/duplicated.html">anyDuplicated</a></code>, these functions test for canonical equivalence of strings (and not whether the strings are just bytewise equal) Such operations are locale-dependent. Hence, <code>stri_duplicated</code> and <code>stri_duplicated_any</code> are significantly slower (but much better suited for natural language processing) than their base R counterparts. </p> <p>See also <code><a href="stri_unique.html">stri_unique</a></code> for extracting unique elements. </p> <h3>Value</h3> <p><code>stri_duplicated()</code> returns a logical vector of the same length as <code>str</code>. Each of its elements indicates whether a canonically equivalent string was already found in <code>str</code>. </p> <p><code>stri_duplicated_any()</code> returns a single non-negative integer. Value of 0 indicates that all the elements in <code>str</code> are unique. Otherwise, it gives the index of the first non-unique element. </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_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_sort.html">stri_sort</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> <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_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_sort.html">stri_sort</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> # In the following examples, we have 3 duplicated values, # "a" - 2 times, NA - 1 time stri_duplicated(c("a", "b", "a", NA, "a", NA)) stri_duplicated(c("a", "b", "a", NA, "a", NA), fromLast=TRUE) stri_duplicated_any(c("a", "b", "a", NA, "a", NA)) # compare the results: stri_duplicated(c("\u0105", stri_trans_nfkd("\u0105"))) duplicated(c("\u0105", stri_trans_nfkd("\u0105"))) stri_duplicated(c("gro\u00df", "GROSS", "Gro\u00df", "Gross"), strength=1) duplicated(c("gro\u00df", "GROSS", "Gro\u00df", "Gross")) </pre> <hr /><div style="text-align: center;">[Package <em>stringi</em> version 1.4.6 <a href="00Index.html">Index</a>]</div> </body></html>