[R] Backslash \ in string
Claudia Beleites
cbeleites at units.it
Thu Jul 15 23:43:00 CEST 2010
Jannis,
> You are right, it does not seem to matter. When the R string contains
> two \\, xtable prints it as only one \. I should have looked into the
> Latex output before posting!
'\\' is just _one_ character in R:
> nchar ("\\")
[1] 1
Just like '\n' etc.
It is just the `print`ed (as opposed to cat) output that mislead you:
the print function displays a bunch of special characters in their
backslash-escaped fashion:
> print ("someting\tblah\\blubb\n")
[1] "someting\tblah\\blubb\n"
> cat ("someting\tblah\\blubb\n")
someting blah\blubb
> print ("\12")
[1] "\n"
Claudia
More information about the R-help
mailing list