Generates a descriptive graph for a quantitative variable.
univariate_plot(
data,
x,
bins = 30,
fill = "deepskyblue",
pointcolor = "black",
density = TRUE,
densitycolor = "grey",
alpha = 0.2,
seed = 1234
)
a data frame.
a variable name (without quotes).
number of histogram bins.
fill color for the histogram and boxplot.
point color for the jitter plot.
logical. Plot a filled density curve over the the histogram. (default=TRUE)
fill color for density curve.
Alpha transparency (0-1) for the density curve and jittered points.
pseudorandom number seed for jittered plot.
a ggplot2 graph
univariate_plot
generates a plot containing three graphs:
a histogram (with an optional density curve), a horizontal
jittered point plot, and a horizontal box plot. The subtitle
contains descriptive statistics, including the mean, standard
deviation, median, minimum, maximum, and skew.
The graphs are created with ggplot2 and then assembled into a single plot through the patchwork package. Missing values are deleted.
univariate_plot(mtcars, mpg)
univariate_plot(cardata, city_mpg, fill="lightsteelblue",
pointcolor="lightsteelblue", densitycolor="lightpink",
alpha=.6)