Hello. This may be a bit of a minor question. I was fiddling around with trying to create a data frame from scratch and I noticed that tibbles and data frames appear to display decimal places a bit differently. Is this a deliberate feature of tibbles, or am I doing something wrong?
An example with some fake data (hopefully reproducible):
test_tbl <- tibble(
aa = c(5.5, 10.1, 100.3),
bb = c(3.334, 55.123, 123.556)
)
test_df <- data.frame(
aa = c(5.5, 10.1, 100.3),
bb = c(3.334, 55.123, 123.556)
)
Here is how they look on the console. Note that row #3 of the bb variable is displayed as 124 in the tibble, but 123.556 in the data frame.
> test_tbl
# A tibble: 3 x 2
aa bb
<dbl> <dbl>
1 5.50 3.33
2 10.1 55.1
3 100 124
> test_df
aa bb
1 5.5 3.334
2 10.1 55.123
3 100.3 123.556
Also, when I apply the round function, it doesn't seem to do anything to the tibble display.
> round(test_df, 2)
aa bb
1 5.5 3.33
2 10.1 55.12
3 100.3 123.56
# notice that the bb variable went from 3 decimal places to 2 decimal places
> round(test_tbl, 2)
# A tibble: 3 x 2
aa bb
<dbl> <dbl>
1 5.50 3.33
2 10.1 55.1
3 100 124
# No change in decimal places
Is there a way to change the display of decimal places in tibbles? I think I found a way to change significant digits, but I wasn't able to find a way to change the decimal places display.
Thanks for reading my question!