Escaping backslash (\) in string or paths in R

后端 未结 4 1499
名媛妹妹
名媛妹妹 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:05

    The problem is that every single forward slash and backslash in your code is escaped incorrectly, resulting in either an invalid string or the wrong string being used. You need to read up on which characters need to be escaped and how. Take a look at the list of escape sequences in the link below. Anything not listed there (such as the forward slash) is treated literally and does not require any escaping.

    http://cran.r-project.org/doc/manuals/R-lang.html#Literal-constants

提交回复
热议问题