Dear R useRs,
Sorry for this foolish question, but I can't find how to escape the *
character when using grep :
grep(-, c(/3, 2*3, 4-4))
[1] 3
grep(/, c(/3, 2*3, 4-4))
[1] 1
grep(*, c(/3, 2*3, 4-4))
Erreur dans grep(*, c(/3, 2*3, 4-4)) :
expression régulière incorrecte '*'
De plus : Warning
On 1/9/2009 10:38 AM, David Hajage wrote:
Dear R useRs,
Sorry for this foolish question, but I can't find how to escape the *
character when using grep :
You use a backslash to escape the *. Unfortunately, to enter a
backslash in an R string, you need to escape it. So the pattern is \\*.
Use double backslashes:
grep(\\*, c(/3, 2*3, 4-4))
2009/1/9 David Hajage dhajag...@gmail.com
Dear R useRs,
Sorry for this foolish question, but I can't find how to escape the *
character when using grep :
grep(-, c(/3, 2*3, 4-4))
[1] 3
grep(/, c(/3, 2*3, 4-4))
[1] 1
grep(*, c(/3,
Use fixed = TRUE argument to grep.
2009/1/9 David Hajage dhajag...@gmail.com:
Dear R useRs,
Sorry for this foolish question, but I can't find how to escape the *
character when using grep :
grep(-, c(/3, 2*3, 4-4))
[1] 3
grep(/, c(/3, 2*3, 4-4))
[1] 1
grep(*, c(/3, 2*3, 4-4))
Erreur
* must be escaped for grep with \ and \ must be escaped for R itself
with another \, so you need
grep(\\*, c(/3, 2*3, 4-4))
Gabor
2009/1/9 David Hajage dhajag...@gmail.com:
Dear R useRs,
Sorry for this foolish question, but I can't find how to escape the *
character when using grep :
Hi there, you probably want something like:
# R
grep(\\*, c(/3, 2*3, 4-4))
hope that helps a little,
Tony Breyal
On 9 Jan, 15:38, David Hajage dhajag...@gmail.com wrote:
Dear R useRs,
Sorry for this foolish question, but I can't find how to escape the *
character when using grep :
oooups. Thank you very much.
2009/1/9 Duncan Murdoch murd...@stats.uwo.ca
On 1/9/2009 10:38 AM, David Hajage wrote:
Dear R useRs,
Sorry for this foolish question, but I can't find how to escape the *
character when using grep :
You use a backslash to escape the *. Unfortunately, to
7 matches
Mail list logo