I have a data set as shown below:
data <- tribble(
~top_1, ~top_2, ~top_3,
"A", "B", "C",
"B", "B", "B",
"C", "B", "C",
"A", "B", "B",
"A", "A", "A",
"B", "B", "A",
"C", "A", "C",
"A", "A", "A",
"A", "C", "B",
"B", "B", "C",
)
And now, I want to count distinct the rows for each column and have a new data set something like this:
new_data <- tribble(
~product, ~top_1, ~top_2, ~top_3,
"A", .50, .30, .30,
"B", .30, .60, .30,
"C", .20, .10, .40,
)
Could you please help me to be able to create this data?