0

I am reading text from file and modifying it. but when there is forward slash but i am getting error message.

a<-"my\kris"
Error: '\k' is an unrecognized escape in character string starting

how can i handle such special character in R?

Manish
  • 3,341
  • 15
  • 52
  • 87
  • 2
    (a) That's a backslash. (b) Backslashes are "escape characters". To use/refer to a literal backslash, you need to escape it with itself, e.g., `a <- "my\\kris"; print(a); cat(a)` – Gregor Thomas Dec 20 '19 at 20:18
  • 1
    Possible dupes: [How to escape backslash in R string](https://stackoverflow.com/q/11806501/903061), or potentially [Filepath issues in R on Windows](https://stackoverflow.com/q/8425409/903061) – Gregor Thomas Dec 20 '19 at 20:20

0 Answers0