Try this:

subset(toy, !rowSums(mapply(is.element, toy[c('CH', 'DAY')], subset(toy,
SLOPE < 0, CH:DAY))) > 1 | SLOPE < 0)


On Thu, Aug 12, 2010 at 4:11 PM, Toby Gass <tobygass@warnercnr.colostate.edu
> wrote:

> Dear helpeRs,
>
> I have a dataframe (14947 x 27) containing measurements collected
> every 5 seconds at several different sampling locations.  If one
> measurement at a given location is less than zero on a given day, I
> would like to delete all measurements from that location on that day.
>
> Here is a toy example:
>
> toy <- data.frame(CH = rep(3:5,3), DAY = c(rep(4,5), rep(5,4)),
> SLOPE = c(seq(0.2,0.6, .1),seq(0.2, -0.1, -0.1)))
>
> In this example, row 9 has a negative measurement for Chamber 5, so I
> would like to delete row 6, which is the same Chamber on the same
> day, but not row 3, which is the same chamber on a different day.  In
> the full dataframe, there are, of course, many more days.
>
> Is there a handy R way to do this?
>
> Thank you for the assistance.
>
> Toby
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

