1

In R, I wrote:

parse(text = "main\level") # Error

or

parse(text = "main\\level") # Error

or

parse(text = "main\\\\level") # Error

The result that I hope is:

expression(main\level) 

How can I get my expression with a single backslash \ inside?

derive111
  • 143
  • 2
  • 10
  • 1
    Including a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) in your question will increase your chances of getting an answer. – Samuel Nov 12 '17 at 00:38
  • I just fixed the title and the result that I hope. – derive111 Nov 12 '17 at 01:04
  • Do you really need `parse`? Could you just use `expression("main\\level")`? It will print with two backslashes, but only one is there. – Gregor Thomas Nov 12 '17 at 01:13
  • The result of `expression("main\\level")` is not the same as the result of `expression(main\\level)` – derive111 Nov 12 '17 at 01:25
  • Okay, the result of `expression("main\\level")` is different but can you explain why that matters? – Therkel Nov 12 '17 at 08:28
  • In my case, I use expressions for communication between programming languages. – derive111 Nov 12 '17 at 14:57

0 Answers0