I would like to return the count of the unique values for every column in a table. For example, if I have the table:
Testdata <- data.frame(var_1 = c(\"a
library(purrr) Testdata %>% map_dbl(n_distinct) var_1 var_2 var_3 1 1 3 # in your format Testdata %>% map_dbl(n_distinct)%>%melt(value.name = "unique_counts") unique_counts var_1 1 var_2 1 var_3 3