Numeric vector showing pre-specific digits

digits(x, digits, format = "f", ...)

Arguments

x

a numeric vector

digits

an integer to indicate the number of digits to show.

format

format type passed to formatC.

...

additional parameters passed to formattable.

Examples

digits(pi, 2)
#> [1] 3.14
digits(123.45678, 3)
#> [1] 123.457