What is the use of the which() function in R?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: easy
Interview Round: Other
Overview: Asks what the which() function in R returns and when to use it instead of a logical mask. Tests knowledge of index positions, NA handling, which.max and which.min, matrix indices with arr.ind, and the edge cases that cause subsetting bugs.