round_vector: Round univariate

View source: R/round_matrix.R

round_vectorR 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)

cuadramelo documentation built on Oct. 10, 2024, 5:07 p.m.