[R] : regular expressions: escaping a dot
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jun 28 16:08:21 CEST 2007
On Thu, 28 Jun 2007, Peter Dalgaard wrote:
> Prof Brian Ripley wrote:
>>
>>
>> This is explained in ?regexp (in the See Also of ?regexpr):
>>
>> Patterns are described here as they would be printed by 'cat': _do
>> remember that backslashes need to be doubled when entering R
>> character strings from the keyboard_.
>>
>> and in the R FAQ and ....
>>
>>
> Hmm, that's not actually correct, is it? Perhaps this is better
>
> "...entering R character string literals (i.e., between quote symbols.)"
>
> The counterexample would be
>
>> readLines()
> \\abc
> [1] "\\\\abc"
>
> (of course it is more important to get people to read the documentation
> at all...)
The definition of 'character string' used throughout the help is your
'character string literal', as distinct from an element of a character
vector.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list