replace_sequential_duplicates {tidytidbits}R Documentation

Replace sequential duplicates

Description

Replace sequential duplicates

Usage

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

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

[Package tidytidbits version 0.3.2 Index]