Description Usage Arguments Value Examples
An intermediate helper function for surv_prop_table
1 2 | intermediate_surv_prop_table(s, outcome_vars, grouping_vars,
new_outcome_name = "outcome", binary = F)
|
s |
A tbl_svy object created using the srvyr package. |
outcome_vars |
A character vector naming the column(s) in |
grouping_vars |
A character vector naming the column(s) in |
new_outcome_name |
Character with intended name of the column to hold the names of the outcome variables. Ignored if only 1 outcome. |
binary |
Logical indicating whether the outcome(s) are binary in which case only one column of outcome values will be displayed. |
A long format tibble. Each of the initial character columns is named for a grouping variable and list combination of grouping categories for that row The later numeric columns are named for the outcome categories and list the percentages falling into each. Rows should sum to 100, unless outcome is binary in which case only the column for "TRUE" is displayed to avoid redudancy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(ca_school_tbl_svy)
# Multiple grouping variables
ca_school_tbl_svy %>%
intermediate_surv_prop_table(outcome_vars = "school.level",
grouping_vars = c("sch.wide.imp.goal", "comparative.imp.goal"))
# Multiple outcomes
ca_school_tbl_svy %>%
intermediate_surv_prop_table(outcome_vars = c("sch.wide.imp.goal", "comparative.imp.goal"),
grouping_vars = "school.level",
new_outcome_name = "met_standards")
# Binary outcome
ca_school_tbl_svy %>%
intermediate_surv_prop_table(outcome_vars = "eligible.for.award",
grouping_vars = "school.level",
binary = T)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.