Apologies for what's probably quite simple, but I'm having some problems with
sorting a data frame by the number of occurences of each level of a factor.
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'))
I want to sort the dataframe so that the values of df$name that occur most
often are at the bottom - ie. in the order:
attributes(sort(summary(df$name)))$name = "e" "f" "g" "c" "d" "a" "b":