View source: R/round-preserve-sum.R
ps_round_preserve_sum | R Documentation |
Round Values while Preserving their Rounded Sum
ps_round_preserve_sum(x, digits = 0L)
x |
A numeric vector of values to round |
digits |
A count of the number of decimals for rounding |
http://biostatmatt.com/archives/2902
sum(c(0.33, 0.33, 0.33)) round(c(0.33, 0.33, 0.33), 1) sum(round(c(0.33, 0.33, 0.33), 1)) ps_round_preserve_sum(c(0.33, 0.33, 0.33), 1) sum(ps_round_preserve_sum(c(0.33, 0.33, 0.33), 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.