How can I use gsub () all but the specified character in R?
In my problem, I have the following line ...
"the quick brown fox jumps over a lazy dog"
I need to generate a new line by deleting all characters except "r" and "o", and we get the following output ...
"roooro"
Assuming all characters are lowercase, how should I go. I tried...
gsub(!"r","",gsub(!"o","",str1))
But '!' does not work.
source
share