Which indices are TRUE ?

Usage

which(x)

Arguments

x a logical vector or array.

Value

An integer vector with length equal to sum(x), i.e. to the number of TRUEs in x; Basically, the result is (1:length(x))[x].

See Also

Logic

Examples

which(LETTERS == "R")
which((1:12)%%2 == 0) #which are even?


[Package Contents]