zround.Rd
This function takes a numeric vector or a single numeric value and formats it to a specified number of decimal places. The function returns a character vector with the numbers formatted as strings.
zround(x, digits = 2, method = 1)
A character vector with each number in x
formatted to
digits
decimal places.
x = c(5.555, 1.115, -0.002)
zround(x, method = 1)
#> [1] "5.56" "1.11" "0.00"
zround(x, method = 2)
#> [1] "5.55" "1.11" "-0.00"
formatC(x, digits = 2, format = "f")
#> [1] "5.55" "1.11" "-0.00"
formattable::formattable(x, digits = 2, format = "f")
#> [1] 5.55 1.11 -0.00