In base r I can subset a data.frame based on a row range:
mtcars[1:5,]
Or I can subset based on a logical condition:
mtcars[mtcars$cyl==6,]
But I don't appear to be able to do both:
mtcars[1:5 & mtcars$cyl==6,]
Warning message: In 1:5 & mtcars$cyl == 6 : longer object length is not a multiple of shorter object length
Is there another way to do this?
The use case is loading a huge .csv with the LaF package, which allows for filtering using commands similar to base r, but which loads things much quicker with row ranges than with conditions, and adding more than one condition means that I will sometimes have to wait a day for the data to load.