William Dunlap wrote:
sub(x='|t|',pattern = '\|t',replacement='zz')
[1] zz|t|
Warning messages:
1: '\|' is an unrecognized escape in a character string
2: unrecognized escape removed from \|t
How can \| be an unrecognized escape? This flatly contradicts
help('regex'),
It would
Here is my interaction with R:
sub(x='|t|',pattern = '|t',replacement='zz')
[1] zz|t|
So I say to myself Clearly the | signs need to be escaped, so let's try
this
sub(x='|t|',pattern = '\|t',replacement='zz')
[1] zz|t|
Warning messages:
1: '\|' is an unrecognized escape in a character string
you need to escape it (twice):
sub(x='|t|',pattern = '\\|t',replacement='zz')
[1] zz|
On Fri, Apr 9, 2010 at 4:35 PM, David.Epstein
david.epst...@warwick.ac.ukwrote:
Here is my interaction with R:
sub(x='|t|',pattern = '|t',replacement='zz')
[1] zz|t|
So I say to myself Clearly the |
Try this:
sub(x='|t|',pattern = '\\|t',replacement='zz')
On Fri, Apr 9, 2010 at 5:35 PM, David.Epstein
david.epst...@warwick.ac.uk wrote:
Here is my interaction with R:
sub(x='|t|',pattern = '|t',replacement='zz')
[1] zz|t|
So I say to myself Clearly the | signs need to be escaped, so
David -
Here's the last paragraph of the Details section
of the regex help page:
Patterns are described here as they would be printed by ‘cat’:
(_do remember that backslashes need to be doubled when entering R
character strings_, e.g. from the keyboard).
You can get around this
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of David.Epstein
Sent: Friday, April 09, 2010 1:36 PM
To: r-help@r-project.org
Subject: [R] perhaps regular expression bug with | sign ??
Here is my interaction with R:
sub(x
6 matches
Mail list logo