View source: R/make_demographic_table.R
| make_demographic_table | R Documentation |
Create a demographics summary table
make_demographic_table(data, vars, continuous_vars = NULL)
data |
A data frame |
vars |
demographic variables to include in the table |
continuous_vars |
Optional subset of vars to be treated as continuous |
A gtsummary table
df <- data.frame(
age = c("25", "30 years", "35", " 40 ", "22.5", "28+", NA, ""),
sex = c("M", "F", "m", "f", " M ", "F", "m", NA),
education = c("HS", "BA", "MA", "ma", "Hs", "Ma", "Ba Bed", "Msc bed ")
)
# Generate a demographic summary table (assign to object to avoid printing)
demo_table <- make_demographic_table(df, vars = c("age", "sex", "education"))
demo_table # optionally inspect the table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.