2

In R, while parsing a windows directory address or in general parsing a text string with backstrokes throws the following error:

> 'C:\Users'
Error: '\U' used without hex digits in character string starting "'C:\U"

How to parse such strings?

Henrik
  • 65,555
  • 14
  • 143
  • 159
monte
  • 1,482
  • 1
  • 10
  • 26

1 Answers1

3

With R>4.0.0, it is possible to parse such strings with following syntax:

> r"(C:\Users)"
[1] "C:\\Users"

Note that, () are part of syntax. For simplicity, one can also use r"{...}" and r"[...]"

monte
  • 1,482
  • 1
  • 10
  • 26