I have two binary-valued columns in foods dataframe as follows:
foods$veryHealthy:
"False" "False" "True" "True" "False" "False" "False" "True" "False" "False" "True" "False"
"True" "False" "False" "True" "False" "True" "False" "False" "True" "False" "False" "False" ...
foods$dairyFree:
"True" "True" "True" "True" "True" "True" "True" "True" "False" "True" "True" "False"
"True" "False" "False" "True" "True" "True" "True" "False" "True" "False" "True" "True" ...
I want to get some plot like:
for the x-axis instead of four categories I want to use binary values.
notice how thickness of bars changes based on the number of instances in each class.
I have tried the following code but it did not get me the result:
ggplot(foods, aes(x=veryHealthy, y=dairyFree, fill=dairyFree)) +
geom_col(position = "fill")
edit: I have to use ggplot2 and not any built-in or other libararies.