Paste Symbol Limit

Possible duplicate:
Why and where are \ n newlines introduced in c ()?

I am running R (version 2.15.1) in a bash (version 4.2.36 (1)) on a GNOME terminal (version 3.4.1.1). Sometimes I write my code in a text file, and then paste it directly into the console (when R starts). I did not have any problems until the scripts I pasted grew. Now it seems that any code exceeding 4206 characters (including \n ) is rejected (that is, the first 4206 characters are accepted, and the remaining code is truncated, and the truncation is accompanied by a sound signal from the terminal). This character limit is not specific to bash or GNOME terminals because I do not respect the character limit when pasting, for example, vi . Therefore, I suspect that the character restriction is imposed by R , but does not know how to change it, assuming that this is a user-configurable parameter. Is it possible to change the limit of the paste, and if so, what parameter regulates it?

+4
source share
1 answer

It looks like you are facing a known console limitation. As stated in Section 1.8 - R Commands, Case Sensitivity, etc. Introduction to R :

Command lines entered on the console are limited [3] to approximately 4095 bytes (not characters).

[3] some of the consoles will not let you type in, and among those who do some, they will quietly discard the excess, and some will use it as the beginning of the next line.

Either put the command in a file, or source , or break the code into several lines by inserting your own lines at the corresponding points (between commas).

The value is hardcoded in src/include/Defn.h : #define CONSOLE_BUFFER_SIZE 4096 , so you will need to recompile R to change it.

+8
source

Source: https://habr.com/ru/post/1443908/


All Articles