VectorSub | R Documentation |
extending gsub by matching pattern and replacement from two vectors
VectorSub(pattern, replacement, string)
pattern |
vector containing words to match |
replacement |
vector containing words to replace existing words. |
string |
string to replace from |
modified string with replaced values
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"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.