Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ceil

Integer Functions (Matlab Style)


Description

Functions for rounding and truncating numeric values towards near integer values.

Usage

ceil(n)
Fix(n)

Arguments

n

a numeric vector or matrix

Details

ceil() is an alias for ceiling() and rounds to the smallest integer equal to or above n.

Fix() truncates values towards 0 and is an alias for trunc(). Uses ml prefix to indicate Matlab style.

The corresponding functions floor() (rounding to the largest interger equal to or smaller than n) and round() (rounding to the specified number of digits after the decimal point, default being 0) are already part of R base.

Value

integer values

Examples

x <- c(-1.2, -0.8, 0, 0.5, 1.1, 2.9)
ceil(x)
Fix(x)

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.