Skip to content
Back to formatted view

Raw Message

Message-ID: <615E4673-D3FA-42FE-B18D-F661CCCF2EBC@comcast.net>
Date: 2012-05-14T14:16:20Z
From: David Winsemius
Subject: file path
In-Reply-To: <1B1F9B2F-5BB4-43D5-8566-C2CADAC04F5E@xs4all.nl>

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

>
> On 14-05-2012, at 12:07, Wincent wrote:
>
>> Emm, my bad.
>> I meant str <- "abc\d".
>> Any ideas?
>
> gsub("\\\\", "", str)


#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"

-- 

David Winsemius, MD
West Hartford, CT