VectorSub: Pattern Matching and Replacement From Vectors

VectorSubR Documentation

Pattern Matching and Replacement From Vectors

Description

extending gsub by matching pattern and replacement from two vectors

Usage

VectorSub(pattern, replacement, string)

Arguments

pattern

vector containing words to match

replacement

vector containing words to replace existing words.

string

string to replace from

Value

modified string with replaced values

Examples

 pattern <- c("A","B","C")
 replacement <- 1:3
 string <- "A went to B went to C"
 VectorSub(pattern,replacement,string)
 # [1] "1 went to 2 went to 3"

bfw documentation built on March 18, 2022, 6:19 p.m.