[R] gsub() could not replace my string

Christofer Bogaso bogaso.christofer at gmail.com
Fri Oct 7 21:58:43 CEST 2016


Hello again,

I have few many string elements, and some of those elements contain a
special phrase as '"[NA]NA%", which I planned to replace by some
Blank. So I tried with below code in R

> gsub("[NA]NA%", "", "[NA]NA%abcde")
[1] "[NA]NA%abcde"

It appears that, my code could not replace "[NA]NA%" as I wanted to
see "abcde". Can you please help me with what would be the correct
code for doing so.

Thanks in advance



More information about the R-help mailing list