Reputation: 24535
How can I print a double quote symbol ("). I tried different methods mentioned on http://r.789695.n4.nabble.com/How-to-print-a-variable-with-in-double-quotes-td905186.html but they do not work:
print "\""
print as.character(x) ; x should come in quotes
print dQuote(x)
How can this be done?
Upvotes: 2
Views: 151
Reputation: 33607
There are two string formats... {This is a string}
and "This is too"
. Escaping is done with a caret, ^
.
If you use the braces you worry less about escaping. You can use single quotes, double quotes, and even braces if they are matched naturally. {This is {a valid} string}
.
So you can say print {"}
or if you insist print "^""
. The former is usually preferable.
Upvotes: 2