I'd like to gain a better understanding of escape character sequences in R. I've tried searching for things like ?'\'
but, that escapes itself and ?'\\'
I'd like to avoid this kind of behaviour with cat()
. For example:
cat("\")
+
Versus:
cat("\\")
\
The help page you are looking for is ?Quotes
(with the capital Q). String literal syntax is also described (less clearly IMHO) at http://cran.r-project.org/doc/manuals/R-lang.html#Literal-constants.
The backslash escape works very nearly the same as it does in C and all the other languages that borrowed backslash escapes from C -- \n
inserts a newline, \\
inserts a single backslash, \"
in a double quoted string prevents the "
from ending the string, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With