# NOT RUN {
data(energy, package="ISwR")
require(sjlabelled)
energy = energy %>%
var_labels(
expend = 'Energy expenditure (MJ/day)',
stature = 'Stature'
)
energy %>%
strip_error(expend ~ stature, col = 'red') %>%
axis_labs()
t.test(expend ~ stature, data = energy)
## Adding an horizontal line to show significant difference:
energy %>%
strip_error(expend ~ stature, col = 'red') %>%
axis_labs() %>%
gf_star(1, 13, 2, 13.2, 13.4, "**")
data(birthwt, package = "MASS")
require(dplyr)
birthwt <- birthwt %>%
mutate(
smoke = factor(smoke, labels = c("Non-smoker", "Smoker")),
Race = factor(race > 1, labels = c("White", "Non-white"))
) %>%
var_labels(
bwt = 'Birth weight (g)',
smoke = 'Smoking status'
)
birthwt %>%
strip_error(bwt ~ smoke|Race, col = 'darksalmon') %>%
axis_labs()
birthwt %>%
strip_error(bwt ~ smoke, col = ~ Race) %>%
gf_refine(ggsci::scale_color_jama()) %>%
axis_labs()
birthwt %>%
strip_error(bwt ~ smoke, pch = ~ Race, col = ~ Race) %>%
gf_refine(ggsci::scale_color_jama()) %>%
axis_labs()
birthwt %>%
strip_error(bwt ~ smoke|Race) %>%
axis_labs()
# }
Run the code above in your browser using DataLab