str_unique: Remove duplicated strings

View source: R/unique.R

str_uniqueR Documentation

Remove duplicated strings

Description

str_unique() removes duplicated values, with optional control over how duplication is measured.

Usage

str_unique(string, locale = "en", ignore_case = FALSE, ...)

Arguments

string

Input vector. Either a character vector, or something coercible to one.

locale

Locale to use for comparisons. See stringi::stri_locale_list() for all possible options. Defaults to "en" (English) to ensure that default behaviour is consistent across platforms.

ignore_case

Ignore case when comparing strings?

...

Other options used to control collation. Passed on to stringi::stri_opts_collator().

Value

A character vector, usually shorter than string.

See Also

unique(), stringi::stri_unique() which this function wraps.

Examples

str_unique(c("a", "b", "c", "b", "a"))

str_unique(c("a", "b", "c", "B", "A"))
str_unique(c("a", "b", "c", "B", "A"), ignore_case = TRUE)

# Use ... to pass additional arguments to stri_unique()
str_unique(c("motley", "mötley", "pinguino", "pingüino"))
str_unique(c("motley", "mötley", "pinguino", "pingüino"), strength = 1)

tidyverse/stringr documentation built on Nov. 20, 2023, 5:16 p.m.