# number of digits higher than number of decimal
roundHalfUpTextFormat(x = c(0.345, 0.567, -0.98), digits = 2)
# number of digits lower than number of decimal
roundHalfUpTextFormat(x = c(0.345, 0.567, -0.98), digits = 0)
# by default, 'digits' is 0!
roundHalfUpTextFormat(x = c(0.345, 0.567, -0.98))
# padding zeros
roundHalfUpTextFormat(1.23, 10)
Run the code above in your browser using DataLab