Find Index of Maximum & Minimum Value of Vector & Data Frame in R (Example) | which.max & which.min

Published: 21 December 2019
on channel: Statistics Globe
10,793
56

How to find the index of the maximum and minimum value with the which.max and which.min functions of the R programming language. More info: https://statisticsglobe.com/r-find-in...
R code:

vec <- c(3, 1, 8, 3, 2, 5) # Create example vector

which.max(vec) # Identify index of max value

which.min(vec) # Identify index of min value

data <- data.frame(x1 = c(7, 8, 1, 4, 0, 5), # Create example data frame
x2 = letters[1:6])
data # Print data to RStudio console

which.max(data$x1) # Apply which.max function to column

which.min(data$x1) # Apply which.min function to column


Watch video Find Index of Maximum & Minimum Value of Vector & Data Frame in R (Example) | which.max & which.min online, duration hours minute second in high quality that is uploaded to the channel Statistics Globe 21 December 2019. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 10,793 times and liked it 56 visitors.