Re: [R] Sorting dataframe by number of occurrences of factor

From: Sharma D <>
Date: Sat, 30 Apr 2011 08:44:10 -0700 (PDT)

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:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 30 Apr 2011 - 17:16:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 30 Apr 2011 - 22:20:34 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive