Description Usage Arguments Value Examples
View source: R/stringmanipulation.R
A function replacing mutiple values from a vector, but using grep. Thus, patterns can be part of the values, or any other pattern grep understands.
1 | valueConvertGrep(valueData, patterns, replacements, other = NA)
|
valueData |
Input |
patterns |
A vector containing which values should be replaced |
replacements |
A vector containing replacement values |
other |
Any vales which is not found in 'patterns' is set to this. Defaults to NA |
a vector with the replaced values
1 2 3 4 5 6 | origin = c("gleason 3+3", "gleason 3+3=6", "gleason 3+3", "gleason 4+3=7", "gleason 3+4=7", "gleason 3+3", "gleason 7")
patternVector = c("3[+]3", "4[+]3", "3[+]4")
replacementVector = c("1", "3", "2")
valueConvert(origin, patternVector, replacementVector, "unknown")
#returns "1", "1", "1", "3", "2", "1", "unknown"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.