Evaluate a numeric value and optionally perform roundx_n before padding the decimal portion of the number to n digits. Note: this coverts the numeric value to a character. The function is intended only for final display purposes.

alignx_n(x, num_dec = 3, pad_char = " ", do_roundx_n = TRUE)

Arguments

x

numeric value to be right justified

num_dec

number of decimal places to justify

pad_char

padding character defaults to  

do_roundx_n

logical to determine if roundx_n is performed. Defaults to True

Value

character

Examples

library(curios)
cat(alignx_n(c(0.12345, 1.123344, 100.12345)), sep = "\n")
#> 0.123
#> 1.12 
#> 100.1  

# Without \code{roundx_n}
cat(alignx_n(c(100.123, 100.23, 100.1), do_roundx_n = FALSE), sep = "\n")
#> 100.123
#> 100.23 
#> 100.1