how to make a subset of logical vector = true?

Hi,

I read a .csv into R and I need to make a subset of the rowsums are smaller than 5000. So I

imm2011 <- read.csv("immunisation-ethnicity-2011-6-months.csv", row.names = 1)

x <- seq(2,10,2)
y <- seq(1,10,2)

elig <- imm2011[,y]
eli <- rowSums(elig,na.rm = TRUE)

small <- eli < 5000
small

It gives something like
Auckland Bay of Plenty Canterbury Capital & Coast
FALSE TRUE FALSE TRUE
Counties Manukau Hawkes Bay Hutt Valley Lakes
FALSE TRUE TRUE TRUE

Now I know which rowsum is less than 5000, but how can I extract the data (sums less than 5000 only) as a subset?

Just a guess without any way to test:

imm2011[small,]

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.