[R] \ escape sequence and windows path

Knut Krueger rh at knut-krueger.de
Tue May 20 16:54:06 CEST 2014


Am 20.05.2014 15:22, schrieb Jeff Newmiller:
> Most importantly, "\\" is a string literal containing ONE backslash character. Yes you can create strings in R source code that represent Windows-style paths, but they must APPEAR different in that context. You may find it helpful to know that the print function can output escaped strings suitable for inclusion in R code, while the cat function can output those same strings without the escaping.

Thanks for your answer,

I am familiar with the escape strings, but I was looking for a way to 
convert copied path from windows:

working:

y=readline()
# paste f.e c:\foo1\foo2
y
[1] "c:\\foo1\\foo2"


but I was looking for

y=foo("c:\foo1\foo2").
because it is annoying to change all \ to \\ or to /

Regards Knut



More information about the R-help mailing list