Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

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.

Example:
library("xplore")
x =(-3:3)/7
(x ~ round(x, 2)) |(round(131, -1) ~ round(131, -2))

Result:
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



Author: T. Kleinow, 20011017
(C) MD*TECH Method and Data Technologies, 05.02.2006