The “floor” Function in R
Package: Base R (No specific package, it’s a built-in function)
Purpose: To round numeric values down to the nearest integer.
General Class: Mathematical Computation
Required Argument(s):
x: A numeric vector or value to be rounded down.
Notable Optional Arguments:
None
Example:
# Example usage
values <- c(3.14, 2.718, 5.55)
# Round down to the nearest integer
floored_values <- floor(values)
print(floored_values)In this example, floor is a built-in function in base R, and it is used to round numeric values down to the nearest integer. The x argument is the required numeric vector or value to be rounded down. There are no notable optional arguments for this function. The result is a numeric vector or value that has been rounded down to the nearest integer.