# NOT RUN {
if (require(mosaicData) && require(dplyr)) {
HELP2 <- HELPrct %>%
group_by(substance, sex) %>%
summarise(
mean.age = mean(age),
median.age = median(age),
max.age = max(age),
min.age = min(age),
sd.age = sd(age),
lo = mean.age - sd.age,
hi = mean.age + sd.age
)
gf_jitter(age ~ substance, data = HELPrct,
alpha = 0.7, width = 0.2, height = 0, color = "skyblue") %>%
gf_pointrange( mean.age + lo + hi ~ substance, data = HELP2) %>%
gf_facet_grid( ~ sex)
gf_jitter(age ~ substance, data = HELPrct,
alpha = 0.7, width = 0.2, height = 0, color = "skyblue") %>%
gf_errorbar( lo + hi ~ substance, data = HELP2) %>%
gf_facet_grid( ~ sex)
gf_jitter(age ~ substance, data = HELPrct,
alpha = 0.7, width = 0.2, height = 0, color = "skyblue") %>%
gf_crossbar( mean.age + lo + hi ~ substance, data = HELP2, fill = "transparent") %>%
gf_facet_grid( ~ sex)
gf_jitter(substance ~ age, data = HELPrct,
alpha = 0.7, height = 0.2, width = 0, color = "skyblue") %>%
gf_crossbarh( substance ~ mean.age + lo + hi, data = HELP2, fill = "transparent") %>%
gf_facet_grid( ~ sex)
}
# }
Run the code above in your browser using DataLab