Escaping backslash (\) in string or paths in R

后端 未结 4 1492
名媛妹妹
名媛妹妹 2020-11-27 08:21

Windows copies path with backslash \\, which R does not accept. So, I wanted to write a function which would convert \\ to /. For exam

4条回答
  •  轮回少年
    2020-11-27 09:08

    chartr0 <- function(foo) chartr('\\','/',foo)
    chartr0('E:\\RStuff\\test.r')
    

    You cannot write E:\Rxxxx, because R believes R is escaped.

提交回复
热议问题