Skip to content
Prev 294488 / 398503 Next

file path

On May 14, 2012, at 6:35 AM, Berend Hasselman wrote:

            
#1:  One cannot execute:  str <- "abc\d" , at least on my machine,  
since that throws an error because "\d" is an "unrecognized escape".

#2: If the string has a backslash as its fourth character then it  
would need to be created with:

str <- "abc\\d"

(Then Berend's gsub would succeed.)

#3: If the string contains an ASCII cntrl-d. then the needed gsub  
command would be:

str <- "abc\004"
gsub("\\\004", "new", str)
[1] "abcnew"