max
Extremes
Description
Return a number that is either the maximum or minimum of the inputs.
Usage
max(..., na.rm = FALSE)
min(..., na.rm = FALSE)
Arguments
... |
any number of numeric arguments. Missing values (NA) are allowed.
|
na.rm= |
a logical flag. If TRUE, missing values are ignored. The
default is FALSE.
|
Details
Any NAs in the data produce NA as a result unless
na.rm = TRUE.
max and min are members of the Summary
group of generic functions.
Value
returns the single maximum (or minimum) value found in the "..."
arguments.
Note
pmax and pmin generate a vector of parallel extremes.
range computes both max and min.
See Also
Examples
# create some sample objects
x <- c(1, 2, 3)
y <- c(4, 5, NA)
min(na.rm = TRUE, x, y) # returns 1 since na.rm = TRUE
min(x, y) # returns NA