[R] copy/paste of large amount of code to terminal leads to scrambled/missing characters

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Sun Feb 4 01:51:37 CET 2018

This sounds like a problem with your editor or the OS clipboard support rather than R. You might get a response here, but R-sig-mac seems more appropriate to me for such discussion.
Sent from my phone. Please excuse my brevity.

On February 3, 2018 4:23:54 PM PST, Martin Batholdy via R-help <r-help at r-project.org> wrote:
>Dear R-users,
>This question might not be restricted to R, but I hope that some might
>have experienced similar problems and could help me.
>When using R, I usually work with a text-editor (textmate2) in which I
>prepare the script.
>To execute code, I then copy and paste it to an R-session running in
>the terminal/shell (on Mac OS).
>Unfortunately, when pasting too much code into the terminal (e.g. 60
>lines), some characters are occasionally and randomly scrambled or
>For example "col <- ifelse(..." turns into "col < col < cse(…".
>This happens very randomly, is difficult to predict, and while it only
>affects a hand full of characters in total, it leads to a lot of errors
>in the code execution along the way.
>Apparently, it has to do with the buffer size and paste-speed of the
>So far, I could not find any solution to the problem.
>Therefore, I wanted to ask; 
>Do others here use a similar workflow (i.e. having a text-editor for
>coding and using copy/paste to the terminal for code execution) and
>encountered similar problems with big chunks of code in the clipboard?
>Are there any solutions for this problem, specifically for running R
>over the shell?
>Thank you very much!
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list