as.which function

Coercion to (positive) integer positions