Hello,

   I have an expression that I want to substitute for something else.

myvector<-c("ajkhfkiuwe","Variable(kg/min)")

if I use the following code to extract "variable(kg/min)" and substitute it for 
"va"

gsub(myvector[grep("var", myvector, ignore=T)], "va", myvector)

 grep identifies the element of the vector that matches my query, but it won't 
substitute the value. I have been reading the help pages for regular 
expression, but still can't figure out the syntax to read parenthesis and 
forward slashes, which are considered metacharacters.


As usual, thank you for your help,

Judith

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to