a <- c(1,2,1,1,1,1,1,2,3,4,1,1,1,1,1,1,1,1)
b <- c("A", "B", "A", "A", "A", "A", "A", "A", "B","A", "B", "A", "A", "A", "A", "A", "A", "B")
c <- cbind(a,b)
df <- data.frame(c)
What is the simplest way to count distinct elements in a data.frame column?