[Rd] "\0" gives no warning "unknown escape sequence" (PR#11107)

volkmar.klatt at bnv-bamberg.de volkmar.klatt at bnv-bamberg.de
Mon Apr 7 23:10:04 CEST 2008

Full_Name: Volkmar Klatt
Version: 2.6.2
OS: linux
Submission from: (NULL) (


the documentation article
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"
# --> [1] "abc"
# --> [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:
# -->[1] "abc"

Volkmar Klatt
volkmar.klatt AT bnv-bamberg.de

More information about the R-devel mailing list