Get the Minimum element of an Object in R Programming – min() Function

function in R Language is used to find the minimum element present in an object. This object can be a Vector, a list, a matrix, a data frame, etc..**min()**

Syntax:min(object, na.rm)

Parameters:object:Vector, matrix, list, data frame, etc.na.rm:Boolean value to remove NA element.

**Example 1:**

`# R program to illustrate ` `# the use of min() function` ` ` `# Creating vectors` `x1 <` `-` `c(` `1` `, ` `2` `, ` `3` `, ` `4` `, ` `5` `, ` `6` `, ` `7` `, ` `8` `, ` `9` `)` `x2 <` `-` `c(` `4` `, ` `2` `, ` `8` `, NA, ` `11` `)` ` ` `# Finding minimum element` `min` `(x1)` `min` `(x2, na.rm ` `=` `FALSE)` `min` `(x2, na.rm ` `=` `TRUE)` |

**Output:**

[1] 1 [1] NA [1] 2

**Example 2:**

`# R program to illustrate ` `# the use of min() function` ` ` `# Creating a matrix` `arr ` `=` `array(` `2` `:` `13` `, dim ` `=` `c(` `2` `, ` `3` `, ` `2` `)) ` `print` `(arr)` ` ` `# Using min() function` `min` `(arr)` |

**Output:**

,, 1 [, 1] [, 2] [, 3] [1, ] 2 4 6 [2, ] 3 5 7,, 2 [, 1] [, 2] [, 3] [1, ] 8 10 12 [2, ] 9 11 13 [1] 2