Dear R helpers, I have a data sheet (milk) with four types of milk from five brands (A, B, C, D, E), the column shows the brands that each customer chose for each type of the milk they bought. The data sheet goes like below. You can see for some type of milk, no brand is chosen.
fatfreemilk fatmilk halfmilk 2fatmilk A A A A A B B A B A A A C C C C D A A A A E A E C A B A A A A A A B B A A A B E I want to summarize each column so that for each type of milk, i know the counts and percentages of the brands chosen for each milk type. I tried "summary" in R, but the result is not shown nicely. How I can display the result in a way like below: A B C D E fatfreemilk 6(60) 1(10) 2(20) 1(10) 0(0) fatmilk 6(60) 2(20) 1(10) 0(10) 1(10) halfmilk 5(50) 4(40) 1(10) 0(0) 0(0) 2fatmilk 7(70) 0(0) 1(10) 0(0) 2(20) Thank you! [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.