[R] data frame filtration

Sean Liang SLiang at wyeth.com
Wed Mar 10 23:09:23 CET 2004


Hi, R-help:

I am a new user of R and am very pleased with R's features. Here I have
one question regarding data frame manipulation. I have a data frame look
like this:

    Fruit Condition
1  Orange   Good
2  Orange    Bad
3  Orange   Good
4  Orange   Good
5  Orange    Bad
6   Apple   Good
7   Apple    Bad
8   Apple   Good
9   Apple   Good
10  Apple    Bad
11  Apple   Good
12  Apple    Bad
13  Mango   Good
14  Mango   Good
15  Mango    Bad

and I like to remove fruit group(s) with three or more "Bad" pieces. In
this case, I want to remove Apple group. Is there an easy way to count
the "Good" and "Bad" in each group then remove the ones that meet the
criteria? 

Thanks for your help.

Sean




More information about the R-help mailing list