[R] dataframe indexing by number of cases per group
Johannes Radinger
JRadinger at gmx.at
Thu Nov 24 13:02:53 CET 2011
Hello,
assume we have following dataframe:
group <-c(rep("A",5),rep("B",6),rep("C",4))
x <- c(runif(5,1,5),runif(6,1,10),runif(4,2,15))
df <- data.frame(group,x)
Now I want to select all cases (rows) for those groups
which have more or equal 5 cases (so I want to select
all cases of group A and B).
How can I use the indexing for such questions?
df[??]... I think it is probably quite easy but I really
don't know how to do that at the moment.
maybe someone can help me...
/johannes
--
More information about the R-help
mailing list