[rkward-users] Command line limit

Birk Diedenhofen mail at birkdiedenhofen.de
Tue May 22 11:25:57 UTC 2012


> have you actually tried this in RKWard? Because to the best of my knowledge,
> we do not have this bug.

Yes, simply run the code generated by this command

   paste("x<-'", paste(rep("|_", 2048), collapse=""), "'", sep="")

and print(x). At the end of the output you should see that one underscore (the
4096th character of the line generated above) is missing: "..._|_|_||_|_|_...".
If you add a line break behind "x<-", rerun the code and print(x) again, the
missing character moves further down the string.


I tried your example and pasted more than 100 times
  x <- "This statement is without a point"
into the console, with and without surrounding curly brackets.

Both times I get this error:

  ...
  > x <- "This statement is without a point"
  > x <- "This statement is without a po
  + x <- "This statement is without a point"
  Error: Unexpected symbol in:
  "x <- "This statement is without a po
  x <- "This"
  > x <- "This statement is without a point"
  > x <- "This statement is without a point"
  > x <- "This statement is without a point"
  ...

However with curly brackets, I additionally get this one at the end:

  ...
  > x <- "This statement is without a point"
  > }
  Error: Unexpected '}' in "}"


I guess that your and my example expose two different problems.


Regards
Birk




Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de> hat am 22.
Mai 2012 um 10:12 geschrieben:

> Hi,
>
> On Monday 21 May 2012, Birk Diedenhofen wrote:
> >  Hi!
> >
> > I just found out that the length of a command line entered into the R
> > console is limited to 4096 characters. In fact, the 4096th character is
> > replaced by a line break. Thus, one character is missing in your code,
> > which can cause a lot of strange errors!
> >
> > I think it would be great if rkward could avoid such problems. This could
> > be achieved, for example, by automatically adding a line break before the
> > 4096th character (instead of replacing it) whenever the command line limit
> > is exceeded.
>
> have you actually tried this in RKWard? Because to the best of my knowledge,
> we do not have this bug.
>
> I ran into this bug in "plain" R, before. And in fact, IIRC, it does not only
> affect long lines, but any long top-level statement(*). I believe the problem
> is that when R's console exceeds the buffer, it will try to read another
> _line_, even if the last thing in the buffer was not a line end. However, I
> never bothered to actually track this down, esp. since - again - this does not
> affect RKWard, as far as I am aware.
>
> Regards
> Thomas
>
> ---
>
> (*) E.g., try pasting the following into an R session on the console:
>
> {
> x <- "This statement is without a point"
> x <- "This statement is without a point"
> x <- "This statement is without a point"
> [...] # repeat this line ~100 times
> x <- "This statement is without a point"
> x <- "This statement is without a point"
> }
>
> The same without curly braces will not trigger the bug.




More information about the Rkward-users mailing list