ceiling
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, ...)

Arguments

x a numeric value. Missing values (NAs) are allowed.
... additional arguments.

Details

These are members of the Math group of generic functions.
Value
returns a vector of the same length and storage mode as x.
ceilingcontains the smallest integers >= x.
floorcontains the largest integers <= x.
trunccontains the closest integers to x between x and 0, inclusive. That is, 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 specific 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
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) 
Package base version 6.1.4-13
Package Index