Re: [R] Delete observations with a frequency < x

2010-12-09 Thread Seeliger . Curt
mathijsdevaan wrote on 12/09/2010 04:21:54 PM: > I have two columns with data (both identifiers - it's an affiliation list) > and I would like to delete the rows in which the observations in the second > column have a frequency < 5 in the entire second column. Example: > > 1 a > 1 b > 1

Re: [R] Delete observations with a frequency < x

2010-12-09 Thread mathijsdevaan
Hi Phil, That worked perfectly! Thanks Mathijs -- View this message in context: http://r.789695.n4.nabble.com/Delete-observations-with-a-frequency-x-tp3081226p3081264.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.

Re: [R] Delete observations with a frequency < x

2010-12-09 Thread Phil Spector
Suppose this is your data frame: df = data.frame(x=c(1,1,1,2,2,2),y=c('a','b','c','a','b','d')) df x y 1 1 a 2 1 b 3 1 c 4 2 a 5 2 b 6 2 d df[!table(df$y)[df$y] < 2,] x y 1 1 a 2 1 b 4 2 a 5 2 b Note that this will only work properly if y is a factor or character variable. If y was num

[R] Delete observations with a frequency < x

2010-12-09 Thread mathijsdevaan
Hi, I have two columns with data (both identifiers - it's an affiliation list) and I would like to delete the rows in which the observations in the second column have a frequency < 5 in the entire second column. Example: 1 a 1 b 1 c 2 a 2 b 2 d Let's say, I would like to