The “ceiling” Function in R

  • Package: Base R (No specific package, it’s a built-in function)

  • Purpose: To round numeric values up to the nearest integer.

  • General Class: Mathematical Computation

  • Required Argument(s):

    • x: A numeric vector or value to be rounded up.

  • Notable Optional Arguments:

    • None

  • Example:

  • # Example usage
    values <- c(3.14, 2.718, 5.55)

    # Round up to the nearest integer
    ceiling_values <- ceiling(values)

    print(ceiling_values)

  • In this example, ceiling is a built-in function in base R, and it is used to round numeric values up to the nearest integer. The x argument is the required numeric vector or value to be rounded up. There are no notable optional arguments for this function. The result is a numeric vector or value that has been rounded up to the nearest integer.

Previous
Previous

The “trunc” Function in R

Next
Next

The “set.seed” Function in R