What is the min() function in R?
Overview
The min() function in R returns the minimum value of a given vector.
Syntax
max(...)
Syntax of the "min()" function in R
Parameter value
The min() function takes the parameter value, ..., which represents the vector objects from which the minimum value is to be determined.
Return value
The min() function returns a numeric value that represents the minimum value in a vector object.
Example
# creating vector objectsa <- c(0.5, 3, 2, 5, 6)b <- c(100, 4, 1)c <- c(99.9, 46, 3, 5)# obtaining the minimum value from the list of vector objectsmin(a, b, c)
Explanation
- Lines 2–4: We create the vector objects,
a,b, andc. - Line 7: We use the
min()function to obtain and print the minimum value from the given vectors.