Skip to content
Prev 279674 / 398506 Next

Select a set of rows based on a condition

If you know the index letters are unique.

df <- data.frame(indx = LETTERS[1:7], levels = sample(7))

ind1 <- which(df$indx == "A")
ind2 <- which(df$indx == "B")

df[ind1:ind2, ]

Michael
On Wed, Dec 7, 2011 at 6:23 AM, RaoulD <raoul.t.dsouza at gmail.com> wrote: