I have looked everywhere here in SO and did not find a solution.
I am trying to create a summary of unique values (factors) of my data set.
Consider this data:
df <- structure(list(x = structure(c(3L, 4L, 1L, 5L, 2L, NA, NA), .Label = c("A",
"H", "M", "R", "Z"), class = "factor"), y = structure(c(NA, 3L,
4L, 5L, 1L, 2L, NA), .Label = c("H", "I", "K", "T", "W"), class = "factor")), class = "data.frame", row.names = c(NA,
-7L))
I am trying to achieve something like this (list, df, tibble are all welcome):
df_sum <- data.frame(A = 1, H = 2, I = 1, M = 1, R = 1, Z = 1,
K = 1, T = 1)
Any help is much appreciated. Thanks in advance!