粘贴字符数限制 [英] paste character limit

查看:71
本文介绍了粘贴字符数限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
为什么以及在何处引入\ n换行符到c()?

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

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

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.8节-R命令所述,区分大小写,例如 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:

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

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

[3]一些控制台不允许您输入更多,而其中一些控制台将默默地丢弃多余的内容,而另一些则将其用作下一行的开始.

[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.

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

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).

该值在src/include/Defn.h:#define CONSOLE_BUFFER_SIZE 4096中进行了硬编码,因此您需要重新编译R才能对其进行更改.

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.

这篇关于粘贴字符数限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆