[R] Misunderstanding escape (backslash)
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Oct 16 20:29:13 CEST 2006
On 10/16/06, Frank McCown <fmccown at cs.odu.edu> wrote:
> Forgive my ignorance, but shouldn't '\\' be converted into '\' in my
> string? In my output (below), you can see that '\\' remains '\\'.
>
> > term = "mother\'s day"
> > term
> [1] "mother's day"
> > term = "mother\\\'s day"
> > term
> [1] "mother\\'s day" <--- should be "mother\'s day"
I think this is just a matter of interpetation of the output:
> strsplit("mother\\'s day", NULL)[[1]]
[1] "m" "o" "t" "h" "e" "r" "\\" "'" "s" " " "d" "a" "y"
> cat("mother\\'s day", "\n")
mother\'s day
> nchar("mother\\'s day")
[1] 13
More information about the R-help
mailing list