Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find documentation on escape characters like "\"

Tags:

r

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("\\")
\
like image 522
Brandon Bertelsen Avatar asked Feb 14 '12 03:02

Brandon Bertelsen


1 Answers

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.

like image 196
zwol Avatar answered Sep 27 '22 17:09

zwol