I'm trying to
Here's the example :
df <- read.table(text =
"sex var value
m a 1
m a 1
m a 0
m b 0
m b 0
f a 1
f a 0
f b 0
f b 1",
header = TRUE,
stringsAsFactors = FALSE
)
What I'd like to create is a bar-chart which has the proportions for each of
the var
values, for each sex
.
So in the above data I would have :
var a :
m : 0.6
f : 0.5
var b :
m : 0
f : 0.5
But expressed as a bar-chart using ggplot