I\'m working in an R script that uses a long SQL string, and I would like to keep the query relatively free of other markup so as to allow copying and pasting between editor
I'd recommend just using a plain string, and not embedding variable values into it. Use placeholders instead.
sql <- "SELECT foo FROM bar
WHERE col1 = ?
AND col2 = ?
ORDER BY yomama"
I'm not sure if the double-quote is the best way to embed multi-line strings in R code (is there something like here-docs?), but it does work, unlike in Java.
Is there some reason you don't want to send "\n" or "\t" to your database? They should be fine in the SQL.