Your fundamental problem is that R will signal an error as soon as it sees one backslash before any character, except for a few lowercase letters, backslashes, quotation marks, or some conventions for entering octal, hexadecimal, or Unicode sequences. This is because the interpreter sees the backslash as a message to βescapeβ from the usual translation of characters and do something else. If you need one backslash in your character element, you need to enter 2 backslashes. This will create one backslash:
nchar("\\")
The section "character vectors" _Intro_to_R_ says:
"Character strings are entered using either matching double (") or single (') quotes, but are printed using double quotes (or sometimes without quotes). They use C-style escape sequences, using \ as the escape character, so \ is entered and printed as \, and inside the double quotes is entered as \ ". Other useful escape sequences are \ n, newline, \ t, tab and \ b, backspace-see? Quotes for a complete list.
?Quotes
source share