Skip to content

attached file with syntax error

7 messages · bry@xdocs.dk, Eric Lecoutre, Barry Rowlingson +4 more

#
Well...

You just can't end vector declaration with a comma...
Error: syntax error
Eric

Eric Lecoutre
UCL /  Institut de Statistique
Voie du Roman Pays, 20
1348 Louvain-la-Neuve
Belgium

tel: (+32)(0)10473050
lecoutre at stat.ucl.ac.be
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre

If the statistics are boring, then you've got the wrong numbers. -Edward
Tufte
#
Eric Lecoutre wrote:
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
#
You can in R-2.1.0 Patched:

 > c(1,)
[1] 1

--sundar
Eric Lecoutre wrote:
#
On 20-May-05 Eric Lecoutre wrote:
Well, maybe some people can't achieve that, but I can:
[1] 1 2 3

(on both R-1.8.0 and R-2.1.0beta)

Best wishes to all,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 20-May-05                                       Time: 14:07:14
------------------------------ XFMail ------------------------------
#
Sundar Dorai-Raj <sundar.dorai-raj at pdf.com> writes:
I can in versions going back to 1.8.0 (did Eric accidentally include
the ">" perhaps?)

However, the code in r.txt runs OK on 2.1.0, but bombs on 2.0.1 with
,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0+ ,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,)
Error: Object "??" not found
Execution halted

(Notice irregularity around char #1024). Not quite sure when (or even
if!) this got fixed.
#
It might be worth pointing out that R is supposed to have a 1024 byte (not 
character) input buffer, and I did fix a few things related to that when 
internationalizing the parser (and also some about multi-byte pushbacks 
which I suspect is the issue here).

It is still good practice to keep input lines well below that buffer size.
On Fri, 20 May 2005, Peter Dalgaard wrote: