which.maxn function

Where are the n largest or n smallest elements in a numeric vector ?