Re: [R] Increasing Console "Paste Buffer"

From: Jan T. Kim <jtk_at_cmp.uea.ac.uk>
Date: Wed 01 Jun 2005 - 20:20:30 EST

On Tue, May 31, 2005 at 11:47:05PM +0100, Gavin Simpson wrote:
> Manuel Morales wrote:
> >Hello list.
> >
> >I'm using R from the gnome-terminal in Fedora. My preference is to write
> >programs in VIM, and then source the file from R, or copy and paste the
> >lines into the console. I'm wondering if there is a way to increase the
> >"paste buffer" as an alternative to "sourcing" large analyses. As was
> >mentioned in a recent thread on Linux GUI's, I find that if I paste in a
> >large amount of text, the lines end up getting cut off at some point. I
> >wonder if this is an R restriction, because it seems like I am able to
> >paste substantially more text in other console-based programs. Is there
> >any way to increase the amount of text that I can paste into an R
> >session?
> >
> >Thanks!
> >
> >Manuel
> >
>
> Manuel,
>
> Maybe I misunderstand what you mean by "lines end up getting cut off at
> some point" so correct me if I got it wrong, but I assume you mean that
> after a certain number of lines entered you can no longer scroll back up
> and view the earlier lines?

I think that this is not an issue of the scroll buffer, but of buffers internal to the terminal program or the shell, which are designed to hold keyboard input and which can be overwhelmed by the rate of input when large text selections are pasted in, as this appears as though thousands of keys had been typed almost instantaneously from their view, so to speak.

The point at which the buffer overruns is quite unpredictable and irreproducible, but generally, the slower a program is to interpret its input, the faster the overrun occurs. Editors like vim are likely processing their input much faster than R, and they may therefore be much less prone to this effect.

I've seen this phenomenon with rxvt and the fancy terminals that come with Gnome and KDE. The only terminal program with which I've never seen that is xterm -- but that doesn't mean that xterm is entirely proof against such loss of input either.

Pasting in larger amounts of code frequently results in a screen which is rather difficult to interpret. More than once, I've been called to help people who didn't get the desired result from pasting code they presumed correct int some terminal, only to find that they were overlooking that error message triggered by line 7 out of 53 lines because that was hidden in the swamp resulting from all the subsequent lines of input and any output triggered by these. One fundamental problem with pasting lines is that the pasted matter will continue to be entered into the interpreter regardless of any errors caused along the way.

For these reasons, I generally strongly recommend against pasting into terminals.

In R, use the source() instead... ;-)

Best regards, Jan

-- 
 +- Jan T. Kim -------------------------------------------------------+
 |    *NEW*    email: jtk@cmp.uea.ac.uk                               |
 |    *NEW*    WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Jun 01 19:33:00 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:20 EST