The floor()
function in R returns the highest number that is less than or equal to a number set as a parameter.
Figure 1 below shows the mathematical representation of the floor()
function and the corresponding expression in R.
floor(number)
This function requires a number to round down as a parameter.
floor()
returns the largest number that is less than or equal to a number set as a parameter.
#Positive numbera <- floor(10);print(paste0("floor(10): ", a))b <- floor(5.3);print(paste0("floor(5.3): ", b))#negative numberc <- floor(-10);print(paste0("floor(-10): ", c))d <- floor(-5.3);print(paste0("floor(-5.3): ", d))