-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Ista Zahn
Sent: Wednesday, March 07, 2012 6:55 PM
To: Greg Snow
Cc: r-help@r-project.org; Markus Elze
Subject: Re: [R] gsub: replacing double backslashes with single backslash
On Wed, Mar 7, 2012 at 12:57 PM, Greg Snow 538
Hello everybody,
this might be a trivial question, but I have been unable to find this using
Google. I am trying to replace double backslashes with single backslashes using
gsub. There seems to be some unexpected behaviour with regards to the
replacement string \\. The following example uses
On Mar 7, 2012, at 6:54 AM, Markus Elze wrote:
Hello everybody,
this might be a trivial question, but I have been unable to find
this using Google. I am trying to replace double backslashes with
single backslashes using gsub.
Actually you don't have double backslashes in the argument you
The issue here is the difference between what is contained in a string
and what R displays to you.
The string produced with the code:
tmp - C:\\
only has 3 characters (as David pointed out), the third of which is a
single backslash, since the 1st \ escapes the 2nd and the R string
parsing
On Wed, Mar 7, 2012 at 12:57 PM, Greg Snow 538...@gmail.com wrote:
The issue here is the difference between what is contained in a string
and what R displays to you.
The string produced with the code:
tmp - C:\\
only has 3 characters (as David pointed out), the third of which is a
You are chasing your tail. You have already achieved your goal, but you don't
seem to understand that.
The three characters
C:\
are represented in R as
C:\\
so when you see the latter, the former is what is actually already in memory.
C:\
is not legal R code (it is an unterminated string).
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Ista Zahn
Sent: Wednesday, March 07, 2012 6:55 PM
To: Greg Snow
Cc: r-help@r-project.org; Markus Elze
Subject: Re: [R] gsub: replacing double backslashes with single backslash
7 matches
Mail list logo