Pattern replacement in a list of character vectors

lgsub(
  pattern,
  replacement,
  x,
  ignore.case = FALSE,
  perl = FALSE,
  fixed = FALSE,
  useBytes = FALSE,
  ...
)

Arguments

pattern, replacement, ignore.case, perl, fixed, useBytes

all arguments are passed to base::gsub() after x is converted to a character vector.

x

list object that contains character vectors.

...

additional arguments are ignored.

Details

This function is a simple wrapper around base::gsub() except it operates on a list.

Note that this function assumes the input data contains vectors and not embedded list objects.

Examples

x <- list(a=c("A", "B"), b=c("C,D")); lgsub(",", "!:!", x)
#> $a #> [1] "A" "B" #> #> $b #> [1] "C!:!D" #>