Determines the location, i.e., index of the (first) minimum or maximum of a numeric vector.
Usage which.min(x) which.max(x) x <- c( 1, 4, 3, 9, 6, 7) which.max(x)
Output:
$Rscript main.r [1] 4 # position {Or} Position particular number(another way) x [which.max(x)]
Output:
[1] 9
For Minimum Value:
x <- c( 1, 4, 3, 9, 6, 7) which.min(x)
output:
$Rscript main.r
[1] 1
Position particular number
x [which.min(x)]
Output:
[1] 1
Range: A function called range() is also available which returns the minimum and maximum in a two element vector.
Range(x) [1 ] 1 9