my_round: The function to round to n decimals or to the nearest non-zero decimal place, if rounding to n yields zero.
Description
Returns the rounded number to the n decimals or to the nearest non-zero decimal place,
if rounding to n decimals yields zero. The default for n is 2.
Function is borrowed from this
link.
Usage
my_round(x, n = 2)
Value
The rounded number to n decimals, and if this is zero to the nearest nonzero decimal
Arguments
x
A real number on which rounding will be applied
n
Number of decimal places to round the number. If rounding yields 0, it rounds to the nearest non-zero decimal place.