sum_check: sum_check check if elements in a vector sum to an expected...

View source: R/ACutils_export.R

sum_checkR Documentation

sum_check check if elements in a vector sum to an expected value. Elements of the vector are supposed to be computed as expected_sum*p. If expectations are not respected return a corrected version of vec, according to p

Description

sum_check check if elements in a vector sum to an expected value. Elements of the vector are supposed to be computed as expected_sum*p. If expectations are not respected return a corrected version of vec, according to p

Usage

sum_check(vec, expected_sum, p)

Arguments

vec

vector to integer value to be checked

expected_sum

expected value for sum(vec)

p

theoretical weights applied to divide expected_sum in vec's elements

Value

corrected version of vec (if needed)


alessandrocolombi/ACutils documentation built on March 3, 2023, 4:06 a.m.