Reputation: 11
When I divide 68/70
then take * 100
at the command line I get 97.14286
but when I include that formula in summarise(perc_survived = (survived/N)*100)
the output is 97.1
. Why is that so?
I checked getOption("digits")
and got back 7
. The output column is labeled as double
, so why the truncated decimal place?
summarise(N = n(), survived = sum(Survived), perc_survived = (survived/N)*100)
Upvotes: 1
Views: 562
Reputation: 56149
It is just tibble print formatting, see below:
identical(
tibble(survived = 68, N = 70) %>% summarise(new = (survived/N)*100) %>% .$new,
68/70 * 100
)
# [1] TRUE
Upvotes: 2