Integer Values

DESCRIPTION:
Creates integers from floating point numbers by going to the next larger integer (ceiling), the next smallest (floor), or the next integer closer to zero (trunc).

USAGE:
ceiling(x)
floor(x)
trunc(x)

REQUIRED ARGUMENTS:
x:
numeric. Missing values (NAs) are allowed.

VALUE:
vector of the same length and storage mode as x.

ceiling(x) contains the smallest integers >= x.

floor(x) contains the largest integers <= x.

trunc(x) contains the closest integers to x between x and 0, inclusive, e.g., trunc(1.5) is 1, and trunc(-1.5) is -1. trunc is like floor for positive values and like ceiling for negative values.


CLASSES:
This function will be used as the default method for classes that do not inherit a specifc method for the function or for the Math group of functions. The result will retain the class and the attributes. If this behavior is not appropriate, the designer of the class should provide a method for the function or for the Math group.

DETAILS:
These are members of the Math group of generic functions.

SEE ALSO:
round , integer .

EXAMPLES:
ceiling(c(-1.9, -1.1, 1.1, 1.9)) # returns c(-1,-1,2,2)
floor(c(-1.9, -1.1, 1.1, 1.9)) # returns c(-2,-2,1,1)
trunc(c(-1.9, -1.1, 1.1, 1.9)) # returns c(-1,-1,1,1)