Is it possible to filter out subsets of the data that have small numbers of observations within a ggplot2 call?
For example, take the following plot: qplot(price,data=diamonds,geom="density",colour=cut)

The plot is a little busy, and I would like the exclude the cut values with a small number of observations, ie,
> xtabs(~cut,diamonds)
cut
Fair Good Very Good Premium Ideal
1610 4906 12082 13791 21551
the Fair and Good qualities of the cut factor.
I’m wanting a solution that can fit an arbitrary data set and if possible be able to select not just by a threshold number of observations, but by top 3 for example.
countcounts up each elements into data.frame.arrangeorders a data.frame based on the specified column.descenables reversed-order sorting.%in%.