View source: R/generate_xtab.R
generate_xtab | R Documentation |
This function takes a data frame or a tibble object, a few variables, and a string caption, returning
a list object that is an instance of class flextable
. The function implements data masking internally
so users must specify data variables as strings (i.e. use "x", "y", "weight").
generate_xtab(df, x, y, weight, caption)
df |
A data frame or tibble. |
x |
A single string of the independent variable. |
y |
A single string of the dependent variable. |
weight |
A single string of the weighting variable. |
caption |
A length one character vector used as the caption for the crosstab. |
A list object, which is an object of class flextable
.
generate_xtab_3way()
for three-way crosstabs.
# Generate a crosstab df %>% generate_xtab(df = ., "x_var", "y_var", "weight", "X by Y")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.