虽然很基础,但我找不到任何答案:如何在tibble中禁用科学计数法,并显示小数?
我的数据
我有一个简单的tibble,是通过lm() %>% broom::tidy()
得到的。
library(tidyverse)
## I used dput() to get this:
tidy_lm_output <- structure(list(term = c("(Intercept)", "mood", "sleep"), estimate = c(-0.00000000000000028697849703988,
-0.0746522106739049, 0.835867664974019), std.error = c(0.0319620048196539,
0.0464197056030362, 0.0464197056030362), statistic = c(-0.00000000000000897873893265334,
-1.60820086435494, 18.006742053085), p.value = c(0.999999999999993,
0.108628280589954, 9.41480010964234e-53)), row.names = c(NA,
-3L), class = c("tbl_df", "tbl", "data.frame"))
> tidy_lm_output
## # A tibble: 3 x 5
## term estimate std.error statistic p.value
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 (Intercept) -2.87e-16 0.0320 -8.98e-15 10.00e- 1
## 2 mood -7.47e- 2 0.0464 -1.61e+ 0 1.09e- 1
## 3 sleep 8.36e- 1 0.0464 1.80e+ 1 9.41e-53
奇怪的是,只有“std.error”列以小数形式显示,而其他所有列都以科学计数法显示。
我希望所有列都以小数形式显示信息,同时仍然作为tibble呈现。
尝试解决问题
- 常用的
options(scipen=999)
解决方案不起作用。 - 使用
format(scientific = FALSE)
也没有效果。
在其他地方提出的这些问题
- 某人在这里提出了这个问题,但没有得到答案。