order(vector, decreasing=TRUE)[1:N] # for positive values order(abs(vector), decreasing=TRUE)[1:N] # for pos & neg