[R] \ escape sequence and windows path
Knut Krueger
rh at knut-krueger.de
Tue May 20 18:04:31 CEST 2014
Am 20.05.2014 17:32, schrieb Bert Gunter:
>> paste("a","b",sep="\\") ## "\\" is the escaped single backslash
> [1] "a\\b"
>> cat(paste("a","b",sep="\\"))
> a\b
>
> Does this help clarify? Or have i misunderstood you?
@David and @Bert
unfortunately yes. My question is more a system level question as about
any converting functions.
The question is how to paste a windows path directly into an R script
(without readline() or readClipboard() and how could I convert this
string that it is usable in R. Means any function which is not using
escape characters
it seems to be possible for readline() an readClipboard().
I do not want to use y=readline() I do want to use
y=foo("c:\foo1\foo2\") but this seems to be impossible because R is
interpreting one backslash as escape sequence. So how does readline()
and readClipboard() are working? Is there any other callback from utils
which is able to deal with this?
I am afraid there is no way.
The reason is to prevent errors for beginning windows R user. If the
path is long they either forget to convert one backslash or all and then
they are frustrated that it is not working. And telling them to use
search and replace ... Whatever they would replace it might be worse
than before ;-)
regards Knut
More information about the R-help
mailing list