# R - floor() Function

The R floor() function returns the next lowest integer value by rounding down the specified number, if necessary. In other words, it rounds the fraction DOWN of the given number. In special cases it returns the following:

• If the argument value is already an integer, then the result is the same as the argument.
• If the argument is NaN or infinity, then the result is the same as the argument.

### Syntax

```floor(x)
```

### Parameters

 `x` `Required. `Specify column to compute on.

### Return Value

Returns the next lowest integer value by rounding DOWN the specified number, if necessary.

### Example:

In the example below, floor() function is used to round the fraction DOWN of the specified value.

```#operating on single element atomic vector
print(floor(-1))
print(floor(0.5))
print(floor(1.4))

cat("\nOperating on vector\n")
#operating on vector
v <- c(10.3, 10.5, 10.7, -10.3, -10.5, -10.7)
print(floor(v))

cat("\nOperating on matrix\n")
#operating on matrix
m <- matrix(c(-10.3, -10.5, -10.7, 100.2, Inf, NaN), nrow=2)
print(floor(m))

cat("\nOperating on first column of matrix\n")
#operating on first column of matrix
print(floor(m[,1]))
```

The output of the above code will be:

``` -1
 0
 1

Operating on vector
  10  10  10 -11 -11 -11

Operating on matrix
[,1] [,2] [,3]
[1,]  -11  -11  Inf
[2,]  -11  100  NaN

Operating on first column of matrix
 -11 -11
```

❮ R Math Functions

5