我如何在R中打印数据框将所有十进制值 [英] How do I print a dataframe in R will all decimal values

查看:151
本文介绍了我如何在R中打印数据框将所有十进制值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要检查其值的数据框,但是当我打印该数据框时,仅打印2或3个小数.我直接检查了数据框,并确认小数位数比正在打印的小数位数多.

I have a dataframe whose values I want to inspect, but when I print the dataframe, only 2 or 3 decimals are printed. I inspected the dataframe directly and confirmed that there are more decimal places than what is being printed.

到目前为止,我已经尝试过print(df, digits=10)options(digits=10),但是这些似乎并没有改变打印输出.

So far I have tried print(df, digits=10) and options(digits=10) but these don't seem to be changing the print output.

一些屏幕截图:

推荐答案

我不完全知道如何加载数据.但是,您的屏幕截图看起来像是

I do not exactly know how you load your data. However, your screenshot looks like you are

以小标题格式查看数据.

looking at data in a tibble format.

x=1.1111
tibble(x) -> x
print(x)
A tibble: 1 x 1
      x
  <dbl>
1  1.11

如果将其转换为data.frame,则可以轻松打印所有数字:

if you convert it to a data.frame, you can print easily all digits:

as.data.frame(x) -> x
print(x)
       x
1 1.1111

更新: 您可以使用print.data.frame()

x = 1.234567890123456
tibble(x) -> x
print.data.frame(x, digits = 10)
#           x
#1 1.23456789

print.data.frame(x, digits = 11)
#             x
#1 1.2345678901

这篇关于我如何在R中打印数据框将所有十进制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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