varviolin | R Documentation |
Violin plots of values of an influencing variable (x) and an outcome variable (y) with different intervals of the influencing variable. Determine different possible variable intervals by calculating the optimal interval width for the given variable using the IQR() function in the stats() package of R, after the Freedman-Diaconis rule (IQR = interquartile range).
varviolin( in_var, out_var, xlab = "Influencing variable", ylab = "Outcome variable", box_width = 0.1, legend_name = "Influencing Variable Intervals", ... )
in_var |
is a vector of observations of a given influencing variable corresponding to another list with observed values of an outcome variable out_var. |
out_var |
is a vector of observed values of an outcome variable corresponding to another list with observations of a given influencing variable in_var. |
xlab |
is a label for the influencing variable in_var on the x axis, the default label is "Influencing variable". |
ylab |
is a label for the outcome variable out_var on the y axis, the default label is "Outcome variable". |
box_width |
is a number between 0 and 1 for the desired width of the violins in the plot. The default is 0.1. |
legend_name |
is a label for the legend, the default label is "Influencing Variable Intervals". |
... |
arguments passed to ggplot2::theme |
in_var <- sample(x = 1:50, size = 20, replace = TRUE) out_var <- sample(x = 1000:5000, size = 20, replace = TRUE) varviolin(in_var, out_var)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.