contCompare | R Documentation |
Compare conditional distributions with continuous outcome with optional graph
contCompare( data, group, outcome, compare = FALSE, baseline = "", FUN = "mean", quantile = 0.5, graph = FALSE, graphType = "diff" )
data |
data frame |
group |
your x variable (a factor variable) |
outcome |
your continuous y variable |
compare |
do you want to compare conditional outcomes to a baseline level of x TRUE or FALSE |
baseline |
the omitted/baseline/reference level of x |
FUN |
a function describing an outcome c(mean, median, sd, var, iqr, quantile, min or max) |
quantile |
a vector to pass to quantile() |
graph |
a TRUE/FALSE indicator of whether or not to print a graph |
graphType |
if a graph will be plotted, print differences or ratios |
library(car) library(tidyverse) contCompare(data = GSSvocab, group = educGroup, outcome = vocab, graph = FALSE) contCompare(data = GSSvocab, group = educGroup, outcome = vocab, graph = TRUE, graphType = "diff", compare = TRUE, baseline = "12 yrs") contCompare(data = GSSvocab, group = educGroup, outcome = vocab, graph = TRUE, graphType = "ratio", compare = TRUE, baseline = "16 yrs") contCompare(data = GSSvocab, group = nativeBorn, outcome = age, compare = FALSE, graph = TRUE, FUN = "median")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.