[R] Multiple line commands in R scripting
Jim Lemon
jim at bitwrit.com.au
Mon Oct 26 03:26:25 CET 2009
Neil Stewart wrote:
>
> I'm wondering whether there is a character to let R know to expect
> more input for a command on subsequent lines.
Hi Neil,
Not that I know of, but I use exactly the method you noticed, the
trailing operator. There was a discussion similar to this not long ago
about the use of the semicolon as a line terminator. If the trailing
operator is a problem, you can wrap the whole statement in parentheses:
x<-(c(1,2,3,4)
/c(1,2,3,4))
or even:
(x<-c(1,2,3,4)
/c(1,2,3,4))
The interpreter will assume that more input is needed from the
unbalanced parenthesis in the first line. An unbalanced quote would also
cause the interpreter to wait for more input, but I don't think it would
be of any use in solving your problem.
Jim
More information about the R-help
mailing list