How do I gsub() everything except a specified character in R?
In my problem I have the following string...
"the quick brown fox jumps over a lazy dog"
I have to generate a new string with by removing all characters except 'r' and 'o' and get the following output...
"roooro"
Assuming all characters are lower case how do I go about. I tried...
gsub(!"r","",gsub(!"o","",str1))
But the '!' doesn't work.