Skip to content
Prev 60074 / 398502 Next

Problem with print() and backslashes.

Kevin Brinkmann <kbrinkm at ump.gwdg.de> writes:
(Didn't we do that one only yesterday?)

The answer is: For the same reason that you need them on input. R
likes to line things up in columns when printing vectors so cannot
just print special characters like newline, carriage return, etc.
Instead it represents them as \n, \r just like on input. To
distinguish from backslash-followed-by-n the backslash is itself
escaped with a backslash. Use cat() to output a string as raw
characters.