[R] attached file with syntax error
Barry Rowlingson
B.Rowlingson at lancaster.ac.uk
Fri May 20 13:55:25 CEST 2005
Eric Lecoutre wrote:
> Well...
>
> You just can't end vector declaration with a comma...
>
>
>>x <- c(0,1,)
>
> Error: syntax error
>
>>x <- c(0,1)
>
You may not be able to, but I can!
> x=c(0,1,)
> x
[1] 0 1
( R 2.0.1 and R 1.8.1 )
I suspect the error is more to do with the length of the line
overflowing a buffer, so that R doesn't see the closing parenthesis, and
then the next line starts with 'x=' (or whatever variable name) so the
parser sees:
a = c(1,1,1,
b = c(1,0,1,1,1,1)
and hence syntax error.
I pasted the long line in interactive mode, and R prompted me for a
continuation with a '+' prompt, even though there was a closing
parenthesis on the long line. That made me think it had truncated the
input.
Further tests reveals the input line is chopped at roughly 1022
characters, which makes me think theres a buffer[1024] somewhere. Its
probably documented as well.
Baz
More information about the R-help
mailing list