You can do something like this with dplyr
set.seed(43)
df<-data.frame(location=sample(LETTERS[1:3],20,replace=TRUE),
site=sample(c("bang","mys","hubl","dar"),20,replace=TRUE))
library(dplyr)
df%>%group_by(location,site)%>%summarize(Count=n())%>%arrange(desc(Count))%>%slice(1)%>%ungroup()%>%select(location,site)
3
solved To get the most frequent levels in a data frame