replace_sequential_duplicates: Replace sequential duplicates

Description Usage Arguments Value Examples

View source: R/purrr-like.R

Description

Replace sequential duplicates

Usage

1
replace_sequential_duplicates(strings, replace_with = "", ordering = NULL)

Arguments

strings

Character vector

replace_with

Replacement string

ordering

Optional: treat strings as if ordered like strings[ordering], or, if a function, strings[ordering(strings)]

Value

A character vector with strings identical to the previous string replaced with replace_with

Examples

1
2
# returns c("a", "", "b", "", "", "a")
replace_sequential_duplicates(c("a", "a", "b", "b", "b", "a"))

tidytidbits documentation built on March 8, 2021, 5:07 p.m.