# NOT RUN {
library(sjlabelled)
data(efc)
data(iris)
# simple plots, two different notations
plot_frq(iris, Species)
plot_frq(efc$tot_sc_e)
# boxplot
plot_frq(efc$e17age, type = "box")
if (require("dplyr")) {
# histogram, pipe-workflow
efc %>%
dplyr::select(e17age, c160age) %>%
plot_frq(type = "hist", show.mean = TRUE)
# bar plot(s)
plot_frq(efc, e42dep, c172code)
}
if (require("dplyr") && require("gridExtra")) {
# grouped data frame, all panels in one plot
efc %>%
group_by(e42dep) %>%
plot_frq(c161sex) %>%
plot_grid()
}
library(sjmisc)
# grouped variable
ageGrp <- group_var(efc$e17age)
ageGrpLab <- group_labels(efc$e17age)
plot_frq(ageGrp, title = get_label(efc$e17age), axis.labels = ageGrpLab)
# plotting confidence intervals. expand grid and v/hjust for text labels
plot_frq(
efc$e15relat, type = "dot", show.ci = TRUE, sort.frq = "desc",
coord.flip = TRUE, expand.grid = TRUE, vjust = "bottom", hjust = "left"
)
# histogram with overlayed normal curve
plot_frq(efc$c160age, type = "h", show.mean = TRUE, show.mean.val = TRUE,
normal.curve = TRUE, show.sd = TRUE, normal.curve.color = "blue",
normal.curve.size = 3, ylim = c(0,50))
# }
Run the code above in your browser using DataLab