[R] interruption when pasting code into R under linux

Marc Schwartz (via MN) mschwartz at mn.rr.com
Tue Dec 13 18:43:27 CET 2005


On Tue, 2005-12-13 at 15:50 +0100, Sebastian Leuzinger wrote:
> hello,
> has anyone come across the following rather mysterious problem: 
> 
> when pasting large bits of code (100 and more lines) into the R console with 
> the central mouse button (under linux), only part of the code is pasted, and 
> the text interrupts somewhere arbitrarily. It does not happen when smaller 
> bits are pasted subsequently.
> 
> I use linux suse 9.3 with the latest version of R

More than likely, you are getting an input buffer overflow. The
arbitrary nature of when this occurs will be dependent upon a variety of
factors, including the complexity of the R code you are pasting and how
fast the R interpreter can process it. 

At some point, a bottleneck is created and the subsequent text in the
input buffer is lost. This behavior is generally intentional to avoid
security risks due to buffer overruns, which is a common method
exploited by folks looking to compromise a system.

See http://en.wikipedia.org/wiki/Buffer_overrun for more information.

You can try to increase the input buffer size for the console to see if
that helps. This will be dependent upon the console app you are using
and the default buffer size in place.

A better solution would be to save the R code in a text file and
source() that file to bring the code into R. See ?source for more
information.

An even better solution, if you are comfortable with emacsen, is to use
ESS. This provides for a more integrated development environment. See:

  http://stat.ethz.ch/ESS/

for more information.

HTH,

Marc Schwartz




More information about the R-help mailing list