Sensible rounding for printing.
rnd(x, digits = 3)
x | A numeric vector |
---|---|
digits | Digits to round to. Default is 3. |
A character vector suitable for printed output.
This is the rounding many are wanting for printing out results. For
example, there will always be digits
number of decimal places, and
trailing zeros will be kept.
#> [1] "-0.560" "-0.230" " 1.559" " 0.071" " 0.129" " 1.715" " 0.461" "-1.265" #> [9] "-0.687" "-0.446"rnd(1)#> [1] "1.000"