[R] filter factors with min. freq

Frank E Harrell Jr fharrell at virginia.edu
Thu Aug 21 13:52:29 CEST 2003


In the Hmisc package see function combine.levels


On Thu, 21 Aug 2003 09:06:21 +0200
"Christian Schulz" <ozric at web.de> 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
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help


---
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat




More information about the R-help mailing list