Other sites

Which function in R

The which() function will return the position of the elements(i.e., row number/column number/array index) in a logical vector which are TRUE. Unlike the other base R functions, the which() will accept only the arguments with typeof as logical while the others will give an error.

x: can be a logical vector or an array. NAs are treated as FALSE and allowed. But they will be omittedarr.ind: logical; should array indices be returned when x is an array?ind: integer-valued index vector, as resulting from which(x).dim: integer vector.dimnames: optional list of character dimnames(.), of which only .dimnames[[1]] is useduseNames: logical indicating if the value of arrayInd() should have (non-null) dimnames at all