[R] gsub issue in R 2.11.1, but not present in 2.9.2

Jason Rupert jasonkrupert at yahoo.com
Tue Jun 29 12:47:41 CEST 2010


Previously in R 2.9.2 I used the following to convert from an improperly formatted NA string into one that is a bit more consistent.   


gsub("N\A", "NA", "N\A", fixed=TRUE)

This worked in R 2.9.2, but now in R 2.11.1 it doesn't seem to work an throws the following error. 
Error: '\A' is an unrecognized escape in character string starting "N\A"

I guess my questions are the following:
(1) Is this expected behavior? 
(2) If it is expected behavior, what is the proper way to replace "N\A" with "NA" and "N\\A" with "NA"?

Thank you again for all the help and insight.



More information about the R-help mailing list