Testdata <- data.frame(var_1 = c("a","a","a"), var_2 = c("b","b","c"), var_3 = c("c","d","e"))
Testdata 
##   var_1 var_2 var_3
## 1     a     b     c
## 2     a     b     d
## 3     a     c     e
apply(Testdata, 2, function(x) length(unique(x)))
## var_1 var_2 var_3 
##     1     2     3
#ref https://stackoverflow.com/questions/22196078/count-unique-values-for-every-column