[Rd] "\0" gives no warning "unknown escape sequence" (PR#11117)
ripley at stats.ox.ac.uk
ripley at stats.ox.ac.uk
Wed Apr 9 08:30:09 CEST 2008
You seem to have missed
'\nnn' character with given octal code (1, 2 or 3 digits)
in ?Quotes, so \0 is a both known and documented escape sequence.
(Yes, really, '0' _is_ 1 octal digit.)
That explains your subject line: such as warning would be misleading in
the extreme.
What is done with \0 is not explained on that help page, but then neither
is what is done with \b or \t -- it is not the parser reference manual.
(There is one, and that is where the semantics should be.)
On Mon, 7 Apr 2008, volkmar.klatt at bnv-bamberg.de wrote:
> Full_Name: Volkmar Klatt
> Version: 2.6.2
> OS: linux
> Submission from: (NULL) (84.147.0.178)
>
>
> Hello,
>
> the documentation article
> ?Quotes
> from package:base could be improved by discussing
> the meaning of "\0" escape sequence.
> In R (currently used: R-2.6.2), a "\0" in a string will
> silently terminate that string, just as it would in C code.
> There is no warning about an unknown escape sequence.
> (cf. R FAQ 7.37)
>
> # example:
> s <- "abc\0def"
> s
> # --> [1] "abc"
> nchar(s)
> # --> [1] 3
>
> The "\0" seems to be so fundamental, that it cannot be handled by
> any R function, am I right?
> E.g., the function escapeBS (package:Hmisc) does not correctly
> handle "\0" sequences, that is in contrast to what is stated in its
> article ?escapeBS :
> "'escapeBS' will escape any backslash '\backslash' in a string.
>
> # example:
> library(Hmisc)
> escapeBS("abc\0def")
> # -->[1] "abc"
>
> Bye,
> Volkmar Klatt
> volkmar.klatt AT bnv-bamberg.de
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
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-devel
mailing list