R/pretty_decimal.R
pretty_decimal.Rd
Choose the final formatting for the number of decimals that should be displayed given a vector of real numbers. All numbers in the returned vector will be unique.
pretty_decimal(x)
A vector of strings containing formatted numerical values all with an equal number of decimal places and at least one decimal place.
pretty_decimal(c(1.0, pi, 3.14, 0.002, 0.0021, 0.02))
#> [1] "1.0000" "3.1416" "3.1400" "0.0020" "0.0021" "0.0200"
# Returns at least one decimal place even if not needed
pretty_decimal(1)
#> [1] "1.0"
# Will return an error because duplicated entries
if (FALSE) { # \dontrun{
pretty_decimal(c(1.1, 1.1))
} # }