I have a data frame as below
multi_df <- data.frame( food=c("A","B","C"),
education=c("A","B","D"),
health=c("F","C","A")
)
I want to check if more than 50% of columns have same response then I will flag it expected output is as below:
output <- multi_df %>%
mutate ( flag= c("more than 50% response is same",
"more than 50% response is same",
"not same response")
)
as seen in above food and education has same value i.e A which is more than 50% of all columns (3)