0

I want to concatenate some special characters with strings like

paste0("\code{", c("A", "B"), "}")

However, the following code works but appends extra \

paste0("\\code{", c("A", "B"), "}")

Would someone point out how to get this?

"\code{A}" "\code{B}"
halfer
  • 19,824
  • 17
  • 99
  • 186
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
  • This has been answered here, https://stackoverflow.com/questions/27721008/how-do-i-deal-with-special-characters-like-in-my-regex – Taran Nov 17 '17 at 14:16
  • How about `cat(paste0("\\code{", c("A", "B"), "}"))` – 989 Nov 17 '17 at 14:17

0 Answers0