我认为这是不可能的,因为整个 R. 的一般显示?options
是关于数字的:
‘digits’: controls the number of digits to print when printing
numeric values. It is a suggestion only. Valid values are
1...22 with default 7. See the note in ‘print.default’ about
values greater than 15.
关键短语是“这只是一个建议”。
接下来,请注意打印的内容首先由print()
应用的方法控制(这在交互使用期间是隐藏的,因为 R auto- print()
s)。有关详细信息?print
,请参见?print.default
基本方法。从?print.default
我们注意到
digits: a non-null value for ‘digits’ specifies the minimum number of
significant digits to be printed in values. The default,
‘NULL’, uses ‘getOption(digits)’. (For the interpretation
for complex numbers see ‘signif’.) Non-integer values will
be rounded down, and only values greater than or equal to 1
and no greater than 22 are accepted.
在详细信息部分,我们有:
The same number of decimal places is used throughout a vector.
This means that ‘digits’ specifies the minimum number of
significant digits to be used, and that at least one entry will be
encoded with that minimum number. However, if all the encoded
elements then have trailing zeroes, the number of decimal places
is reduced until at least one element has a non-zero final digit.
Decimal points are only included if at least one decimal place is
selected.
的默认值digits
是NULL
表示getOption("digits")
使用的,但正如我们已经指出的,这只是一个指南。
似乎没有办法将 R 配置为做你想做的事,也没有办法在全局范围内做。您将需要重写print.default()
或print()
您需要使用的所有方法,并使用这些版本而不是标准版本 --- 现在使用 NAMESPACES 并不容易。