| Library: | xplore |
| See also: | ceil floor rint |
| Quantlet: | round | |
| Description: | Rounds to a given precision. If the precision is omitted the nearest integer is displayed. |
| Usage: | y = round (x{, n}) | |
| Input: | ||
| x | n x p matrix, values which should be rounded | |
| n | optional, number of digits for rounding | |
| Output: | ||
| y | n x 2 matrix, where the first column contains the true values and the second the rounded ones. | |
library("xplore")
x =(-3:3)/7
(x ~ round(x, 2)) |(round(131, -1) ~ round(131, -2))
Contenst of _tmp [1,] -0.42857 -0.43 [2,] -0.28571 -0.29 [3,] -0.14286 -0.14 [4,] 0 0 [5,] 0.14286 0.14 [6,] 0.28571 0.29 [7,] 0.42857 0.43 [8,] 130 100