VectorSub {bfw}R 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"

[Package bfw version 0.4.1 Index]