ggvio: Violin plot wrapper for categorical covariates
Description
Create violin plots for a chosen variable by all discrete covariates in a dataset.
Numeric variables will be dropped, except the chosen variable to plot.
Usage
ggvio(d, var, cats, alpha = 0.1, show = TRUE, nsub = TRUE, ...)
Value
A ggplot object.
Arguments
d
<dfr> A data frame.
var
<var> A variable to plot as unquoted name.
cats
<var> Optional. Categorical variables to plot as a vector of unquoted names.
d = mtcars |> mutate(across(c(am,carb,cyl,gear,vs),factor))
d |> ggvio(mpg)
d |> ggvio(mpg,alpha=0.5)
d |> ggvio(mpg,show=FALSE)
d |> ggvio(mpg,nsub=FALSE)
d |> ggvio(mpg,c(cyl,vs))