Assume, I have a Dataset
like this
ds = Dataset[<|
"Alice" -> <|"food" -> {"apple", "orange"},
"drink" -> {"water", "tea"}|>,
"Bob" -> <|"food" -> {"apple", "banana"},
"drink" -> {"tea", "coffee"}|> ,
"Eve" -> <|"drink" -> {"tea"}|>|>]
This data set consists of three individuals and each has observations for food and drink they consume.
I now want to, for example, plot the percentage of tea drinkers (100%), or the percentage (or number) of banana eaters (33%, 1 out of 3). Ideally this would be a `BarChart like this
where the first three a, b, c's would be apples, bananas, or oranges. The second group of a, b, c would be food items.
Please note that there can be missings (e.g. Eve doesn't have food items but she counts towards the three persons)
I tried something like
ds[BarChart, {All, All, "food"}]
but it doesn't work.
ds[BarChart[#, ChartLabels -> Automatic] &@*Map[Total]@*Transpose@* DeleteMissing@*Map[Counts], "food"]
andds[BarChart[#, ChartLabels -> Automatic] &@*Map[Total]@*Transpose@* DeleteMissing@*Map[Counts], "drink"]
? $\endgroup$