Rev 8401 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{Extremes}\alias{max}\alias{min}\alias{pmax}\alias{pmin}\title{Maxima and Minima}\description{Returns the (parallel) maxima and minima of the input values.}\usage{max(\dots, na.rm=FALSE)min(\dots, na.rm=FALSE)pmax(\dots, na.rm=FALSE)pmin(\dots, na.rm=FALSE)}\arguments{\item{\dots}{numeric arguments.}\item{na.rm}{a logical indicating whether missing values should beremoved.}}\value{\code{max} and \code{min} return the maximum or minimum of all thevalues present in their arguments, as \code{\link{double}}.If \code{na.rm} is \code{FALSE} an \code{NA} value in any of thearguments will cause a value of \code{NA} to be returned, otherwise\code{NA} values are ignored.\code{pmax} and \code{pmin} take several vectors as arguments andreturn a single vector giving the parallel maxima (or minima) of thevectors. The first element of the result is the maximum (minimum) ofthe first elements of all the arguments, the second element of theresult is the maximum (minimum) of the second elements of all thearguments and so on. Shorter vectors are recycled if necessary. If\code{na.rm} is \code{FALSE}, \code{NA} values in the input vectorswill produce \code{NA} values in the output. If \code{na.rm} is\code{TRUE}, \code{NA} values are ignored.\code{\link{attributes}} (such as \code{\link{names}} or\code{\link{dim}}) are transferred from the first argument (if applicable).}\seealso{\code{\link{range}}.}\examples{min(5:1,pi)pmin(5:1, pi)x <- sort(rnorm(100)); cH <- 1.35pmin(cH, quantile(x)) # no namespmin(quantile(x), cH) # has namesplot(x, pmin(cH, pmax(-cH, x)), type='b', main= "Huber's function")}\keyword{univar}\keyword{arith}