Index of true elements - which
- which
# the index of the elements that have TRUE value
which(c(TRUE, FALSE, FALSE, TRUE)) # 1, 4
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
# the index of the elements that have TRUE value
which(c(TRUE, FALSE, FALSE, TRUE)) # 1, 4