【发布时间】:2016-02-22 19:50:04
【问题描述】:
我想减少在 R 中调用 data.table 对象时打印的位数。我宁愿在控制台中放置更多列,而不是每个数字最多看到 8 个小数点。
标准方法options("digits" = 4)(如this question 中所建议)似乎不适用于数据表。
一个例子:
set.seed(7)
DT <- data.table(x = rnorm(10), y = 1:10)
DT # prints 10 digits for me, including the decimal point
options("digits" = 4)
DT # prints 8 digits (?)
不过,一般来说,option 有效,因为
set.seed(7)
rnorm(1)
打印2.287
【问题讨论】:
-
无复制。它在我的控制台上打印了四个。也许你正在使用 Rstudio。
-
它还在我的 RStudio 中打印 4 位数字。您是否重新启动了会话?
-
我在 mac 上使用 R.app
-
我在 Windows 上的 RStudio 中得到 4 位数字。看起来像一个 R.app 问题。 :-(
标签: r data.table