| round_vector | R Documentation |
Rounds a vector preserving the rounded sum.
round_vector(x, digits = 0)
x |
A vector. |
digits |
Number of decimal places to be rounded to. |
description
set.seed(4)
x <- (rnorm(5)*10) |> abs()
y <- round_vector(x)
cbind(x, y)
round(sum(x)) - sum(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.