Skip to content

interruption when pasting code into R under linux

3 messages · Sebastian Leuzinger, Uwe Ligges, Marc Schwartz (via MN)

#
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
 
------------------------------------------------
Sebastian Leuzinger
Institute of Botany, University of Basel
Sch??nbeinstr. 6 CH-4056 Basel
ph    0041 (0) 61 2673511
fax   0041 (0) 61 2673504
email Sebastian.Leuzinger at unibas.ch 
web   http://pages.unibas.ch/botschoen/leuzinger
#
Sebastian Leuzinger wrote:
... because of the limited buffersize of your clipboard.
I'd suggest source()-ing a file rather than pasting those many lines of 
code.

Uwe Ligges
#
On Tue, 2005-12-13 at 15:50 +0100, Sebastian Leuzinger wrote:
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