粘贴字符限制[重复](paste character limit [duplicate])

编程入门 行业动态 更新时间:2024-10-27 14:27:09
粘贴字符限制[重复](paste character limit [duplicate])

可能重复: 为什么以及在哪里将新行字符引入c()?

我在GNOME终端(版本3.4.1.1)中的bash shell(版本4.2.36(1))中运行R (版本2.15.1)。 有时我会将我的代码写入文本文件,然后将其直接粘贴到控制台中(运行R )。 在我粘贴的脚本长度增长之前,我没有遇到任何问题。 现在,似乎任何大于4206个字符(包括\n )的代码都被拒绝(即,接受前4206个字符,其余代码被截断;截断伴随着终端“铃声”)。 此字符限制并非特定于bash或GNOME终端,因为在粘贴到例如vi时我没有观察到字符限制。 因此,我怀疑字符限制是由R强加的,但不知道如何更改它,假设它是用户可配置的参数。 可以更改粘贴限制,如果是,则控制它的参数是什么?

Possible Duplicate: Why and where are \n newline characters getting introduced to c()?

I am running R (version 2.15.1) in a bash shell (version 4.2.36(1)) in the 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 running R). I didn't have any problems until the scripts I was pasting grew in length. Now, it appears that any code greater than 4206 characters (including \n) is rejected (i.e., the first 4206 characters are accepted and the remaining code is truncated; the truncation is accompanied by the terminal "bell" sound). This character limit is not specific to bash or GNOME terminal because I do not observe a character limit when pasting into e.g., vi. Therefore, I suspect that the character limit is imposed by R, but do not know how to change it, assuming it is a user-configurable parameter. Can the paste limit be changed and if so, what parameter governs it?

最满意答案

看起来你遇到了控制台的已知限制。 正如它在第1.7节-R命令,区分大小写等中所述。

在控制台输入的命令行被限制[3]到大约4095字节(不是字符)。

[3]某些游戏机不允许你输入更多,其中一些游戏机会默默地丢弃多余的游戏机,有些会将它作为下一行的起点。

将命令放在文件中并将其获取,或者通过在适当的位置(逗号之间)插入自己的换行符将代码分成多行。

该值在src/include/Defn.h硬编码: #define CONSOLE_BUFFER_SIZE 4096 ,因此您需要重新编译R才能更改它。

It looks like you're running into a known limitation of the console. As it says in Section 1.8 - R commands, case sensitivity, etc. of An Introduction to R:

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

[3] some of the consoles will not allow you to enter more, and amongst those which do some will silently discard the excess and some will use it as the start of the next line.

Either put the command in a file and source it, or break the code into multiple lines by inserting your own newlines at appropriate points (between commas).

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

更多推荐

字符,limit,粘贴,电脑培训,计算机培训,IT培训"/> <meta name="description"

本文发布于:2023-07-04 17:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1027074.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符   paste   character   limit   duplicate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!