View source: R/acled_rounding.R
acled_rounding | R Documentation |
This function addresses some of the conflicts of rounding in R, especially when trying to round up.
acled_rounding(num, digits = 0)
num |
int. This is the number we are trying to round. |
digits |
int. Where do we want to round up. It accepts 0 (whole number), 1 (tenth place), 2 (hundredths), etc. |
This function is meant to address the problem of rounding in R where the approach is always round to even. The function is meant to round things following the simple rule. If the decimal is 5+ then round up, if not round down. With the 'digits' argument, one can set up the specificity of the rounding, 0= whole number, 1 = tenth place, 2=hundreds place, and so on.
A rounded numeric value
x1 <- 1.569
x2 <- 104.530
x3 <- 54.430
x4 <- 205.49999
acled_rounding(x1)
acled_rounding(x2)
acled_rounding(x3)
acled_rounding(x4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.