Skip to content
Prev 381930 / 398502 Next

Two geom_bar with counts to put in the same plot

Hello,

A ggplot graph follows almost exactly my previous code. The *only* 
difference is in facet_wrap(). See below.


library(ggplot2)

idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value = TRUE)
dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv)
dblong <- reshape2::melt(dblong, id.vars = c("variable", "value"))
names(dblong) <- c("deltaVar", "delta", "participationVar", "participation")
dblong <- dblong[complete.cases(dblong),]

ggplot(dblong, aes(x = delta, fill = deltaVar)) +
   geom_density(aes(alpha = 0.2)) +
   scale_alpha_continuous(guide = "none") +
   facet_wrap( ~ participation)


Hope this helps,

Rui Barradas

?s 10:19 de 05/12/19, Francesca escreveu: