[ top | up ]

Maxima and Minima

Syntax

max(..., na.rm=TRUE)
min(..., na.rm=TRUE)

pmax(..., na.rm=FALSE)
pmin(..., na.rm=FALSE)

Value

max returns the maximum of all the values present in its arguments. If na.rm is FALSE an NA value in any of the arguments will cause a value of NA to be returned, otherwise NA values are ignored.

min returns the minimum of all the values present in its arguments. If na.rm is FALSE an NA value in any of the arguments will cause a value of NA to be returned, otherwise NA values are ignored.

pmax takes several vectors as arguments and returns a single vector giving the the parallel maxima of the vectors. The first element of the result is the maximum of the first elements of all the arguments, the second element of the result is the maximum of the second elements of all the arguments and so on. Shorter vectors are recycled if necessary. If na.rm is FALSE, NA values in the input vectors will produce NA values in the output. If na.rm is TRUE, NA values are ignored.

pmin takes several vectors as arguments and returns a single vector giving the the parallel minima of the vectors. The first element of the result is the minimum of the first elements of all the arguments, the second element of the result is the minimum of the second elements of all the arguments and so on. Shorter vectors are recycled if necessary. If na.rm is FALSE, NA values in the input vectors will produce NA values in the output. If na.rm is TRUE, NA values are ignored.