Round to a specified value
Usage
round_to(x, accuracy, direction = c("nearest", "up", "down", "random"))Arguments
- x
A numeric value to round.
- accuracy
The accuracy with which to round (i.e., round to the nearest
accuracy).- direction
The direction to round.
nearest(default) will round to the nearestaccuracy,upwill round up to the nearestaccuracy,downwill round down to the nearestaccuracy, andrandomwill randomly round up or down to the nearestaccuracyas described by Matthews & Harel (2011).
References
Matthews, G., & Harel, O. (2011). Data confidentiality: A review of methods for statistical disclosure limitation and methods for assessing privacy. Statistics Surveys, 5, 1–29. doi:10.1214/11-SS074
