Skip to content
Prev 140763 / 398506 Next

Retrieving locations of element of a vector or matrix

I think that you can use:

x <- sample(1:20, 10)
head(sort(x), 5) #First 5 minimum values
head(sort(x, decreasing = TRUE), 5) #First 5 maximum values
On 31/03/2008, Yemi Oyeyemi <gmoyeyemi at yahoo.com> wrote: