index array r code example Example: index in r which(myVector == 1) # will return all the indices that satisfy the argument