[R] filter factors with min. freq

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Aug 21 10:02:29 CEST 2003


Christian Schulz wrote:

> Hi,
> 
> i use a data.frame with ~ 80.000 observations
> and one attribute is a factor with
> ~ 7300 levels. Is there a easy step which allow
> me to filter out the the data with minimum frequencies i.e. 20
> cases per  level.
> So existing levels with < 20 cases in this factor attribute  are deleted
> from data.frame.
> 
> many thanks and regards,
> christian

Why not calculating a table for that factor and removing those levels 
with n_i < 20 ?

Uwe Ligges




More information about the R-help mailing list