[R] Multi-line string constants: proposal
Mark.Bravington@csiro.au
Mark.Bravington at csiro.au
Fri Dec 27 04:33:03 CET 2002
R's parser complains about syntax like this:
a <- 'one string
that covers several lines'
The parser wants the first line to end with a backslash.
Would it be possible to change the parsing rules to not require the
backslash inside character strings? IE if the line ends before the string
does, and the last character on the line isn't a [single] backslash, then
just auto-add the backslash?
Reasons why this might be useful: [apart from compatibility with Splus 2000,
which doesn't mind the no-backslash syntax-- I don't know about later
versions of S]. When maintaining source code for objects which include large
chunks of text, it is very awkward to have to remember to end each line with
a backslash. I can't just append backslashes to every line, because some of
the source code isn't "inside" a string.
BTW, until and unless the backslash requirement disappears: I couldn't find
any mention of the backslash requirement in the documentation (at least in
what comes with the Windows binary)-- good places might be in the discussion
of character vectors in R-Intro (section 2.6), and in the discussion of the
parser in R-Lang (10.3 I think). Not sure where it might go in the help
system.
cheers
Mark
*******************************
Mark Bravington
CSIRO (CMIS)
PO Box 1538
Castray Esplanade
Hobart
TAS 7001
phone (61) 3 6232 5118
fax (61) 3 6232 5012
Mark.Bravington at csiro.au
More information about the R-help
mailing list