I would like to create a graph for this glmer
fit
mod_germ2trait <- glmer(ger_b~species∗treatment+(1|pop),
family=binomial, data=d)
but even if I tried I don't know how to manage that with ggplot
. ger_b
is a binary variable on which I'm testing several treatments (4) of competition for 2 species of plant with the population as random effect; I would like to show the difference about the species*treatment interaction so I tried this :
ggplot(d, aes(x=treatment,y=as.factor(ger_b),
fill=species, colour=species) )+
geom_bar(stat = "identity")
I'm new to this forum and I apologize myself if this question is not appropriate
EDIT :
I tried to follow the instruction about how to make a R reproducible example :
dput(datashare)
structure(list(Plante = 1:20, traitement = structure(c(3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L), .Label = c("dense", "mi", "peu", "temoin"), class = "factor"),
espece = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("cor",
"mac"), class = "factor"), ger_b = c(0, 0, 0, 1, 0, 1, 0,
0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0)), row.names = c(NA,
20L), class = "data.frame")
My main problem is that i'm not able to make a proprer graph from my data, the one im making doesnt make any sense.