Raw Message
Message-ID: <loom.20110430T225659-737@post.gmane.org>
Date: 2011-04-30T20:58:36Z
From: oliver
Subject: Sorting dataframe by number of occurrences of factor
to the first two lines of your solutions
df<-data.frame(id=c(1:20),name=c('a','b','b','c','a','d','b','e',
'd','d','c','a','b','a','a','b','f','b','c','g'))
freq <- ave(rep(1, times=nrow(df)), df$name, FUN=sum)
I would add:
df[ sort.list(freq), ]