A length-4 vector, the first two positions give the range and
the next two give the positions in x
where the max and min occurred.
This is almost equivalent to c(range(x), which.min(x), which.max(x))
.
Note that the type is not strictly preserved, but no loss should occur. In particular,
logical x
results in an integer result, and a double x
will
have double values for which.min(x)
and which.max(x)
.
A completely empty, logical x
returns c(NA, NA, NA, NA)
as an integer vector.