[R] data frame filtration
Manoj - Hachibushu Capital
Wanzare at HCJP.com
Thu Mar 11 01:36:58 CET 2004
?table
Assuming that your data frame is named as x.
tbl <- table(x)
tbl[tbl[,"Bad"]<3,]
HTH
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Sean Liang
Sent: Thursday, March 11, 2004 7:09 AM
To: R-help at stat.math.ethz.ch
Subject: [R] data frame filtration
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
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list