Jim,

> Does this do what you want?  It creates a new dataframe with those
> 'mg' that have at least a certain number of observation.

Looks good. I also have an alternative solution which appears to work,
so I'll see which is quicker on the big data set in question.

My solution:

mgsize <- as.data.frame(table(in$mg))
in2 <- merge(in,mgsize,by.x="mg",by.y="Var1")
out <- subset(in2, Freq > 1, select= -Freq)

Thanks for your help.

Ron.

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to