round_vector {cuadramelo} | R Documentation |
Round univariate
Description
Rounds a vector preserving the rounded sum.
Usage
round_vector(x, digits = 0)
Arguments
x |
A vector. |
digits |
Number of decimal places to be rounded to. |
Value
description
Examples
set.seed(4)
x <- (rnorm(5)*10) |> abs()
y <- round_vector(x)
cbind(x, y)
round(sum(x)) - sum(y)
[Package cuadramelo version 1.0.0 Index]