Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

which

Showing the indexes of the elements that are TRUE in a boolean vector

n = c(2, 4, 7, 6, 9, 8)
which(n > 4)
which(n > 4 & n %% 2)