Allow Rounding Away From 0
backlog
A
Amber Cobra
Currently, the round feature in Displayr defaults to 'round to even' meaning that 11.5 and 12.5 both round to 12.
Is it possible to implement a round feature in DisplayR that rounds away from zero?
round2 = function(x, digits = 0) {
posneg = sign(x)
z = abs(x)*10^digits
z = z + 0.5 + sqrt(.Machine$double.eps)
z = trunc(z)
z = z/10^digits
z*posneg
}
Suggesting a separate function for rounding in Displayr as a whole, as Displayr follows the base R functionality of rounding to even.
J
Jamie Morris
backlog
T
Timothy George
Ollie created a custom rule to do this. I have the code in a text file that Canny won't upload.