str_replace_same_as_previous: Replace strings that duplicate the previous string

View source: R/stringr-like.R

str_replace_same_as_previousR Documentation

Replace strings that duplicate the previous string

Description

The common use of this function to clean up columns in a presentation-quality table.

Usage

str_replace_same_as_previous(string, replacement)

Arguments

string

a character vector

replacement

text to use as a replacement for duplicated values

Value

a single character vector with immediately repeating items replaced

Examples

str_replace_same_as_previous(
  c("a", "a", "a", "b", "b", "c", "d", "d"),
  ""
)

tjmahr/printy documentation built on March 4, 2024, 1:25 a.m.