Skip to contents

[Experimental]

Help function to format numeric data with formatC function.

Usage

h_fmt_num(x, digits, width = digits + 4)

Arguments

x

(numeric)
numeric input.

digits

(integer)
the desired number of digits after the decimal point (format = "f").

width

(integer)
the total field width.

Value

A character object with specific digits and width.

See also

Examples

h_fmt_num(pi * 10^(-2:2), digits = 2, width = 6)
#> [1] "  0.03" "  0.31" "  3.14" " 31.42" "314.16"