How do I print a dataframe in R will all decimal values

前端 未结 1 887
夕颜
夕颜 2021-01-19 01:45

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 th

相关标签:
1条回答
  • 2021-01-19 01:57

    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
    

    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
    

    Update: you can easily print a tibble in the format you are looking for using 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
    
    0 讨论(0)
提交回复
热议问题