[R] Sorting dataframe by number of occurrences of factor

Sharma D sharma.d at zoho.com
Sat Apr 30 17:44:10 CEST 2011


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) 
rowSums(table(df$name,freq))
--
View this message in context: http://r.789695.n4.nabble.com/Sorting-dataframe-by-number-of-occurrences-of-factor-tp3485443p3486088.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list