I am new to R, please help me out with this embarrassing question.
How do I get the %, ratio of the data in the graph shown in a summary/table ? I need the marital status and the weight in % for each category. I tried a code but failed miserably, please advice.
Thanks in advance
I am looking for a table something similar to this.
Marital Excellent Very good
Married % %
Divorced % %
My non working code
sleep_cleaned %>% group_by(marital, genhlth) %>% tally() %>% mutate(x = n / sum(n)) %>% summary(x= factor(marital), y= factor(genhtlh))