View source: R/analyse_survey_results.R
analyse_survey_results | R Documentation |
Generalizable function to analyse survey data for proportions, means, rates or ratios. Wraps srvyr functions.
analyse_survey_results(
df,
file_path = NULL,
sample_design,
aggregation = NULL,
strata = NULL,
cluster = NULL,
svy_weights = NULL,
proportions = NULL,
means = NULL,
ratios_rates.numerators = NULL,
ratios_rates.denominators = NULL,
ratios_rates.multiplier = NULL
)
df |
Inputs a dataframe with survey data |
file_path |
Optional input of a character file path which to save an excel sheet of the results. |
sample_design |
Input to specify the survey design. Options include 'srs' for simple random sampling, 'two_stage_cluster', 'two_stage_stratified', and 'two_stage_stratified_cluster'. |
aggregation |
Optional input of character value specifying by which variable you want to aggregate or group the results. |
strata |
Optional input for character value specifying the column name of the strata variable. |
cluster |
Optional input for character value specifying the column name of the cluster variable. |
svy_weights |
Optional input for character value specifying the column name of the svy_weights variable. |
proportions |
Optional input for a character vector specifying all the column names to analyse as proportions. If categorical variables are included, then dummy variables will be created for each option. |
means |
Optional input for a character vector specifying all the column names to analyse as means |
ratios_rates.numerators |
Optional input for character vector specifying all the column names of numerators for rates or ratios to analyse. |
ratios_rates.denominators |
Optional input for character vector specifying all the column names of denominators for rates or ratios to analyse. |
ratios_rates.multiplier |
Optional input for numeric value specifying a number to multiply the rate results by. |
Returns a dataframe of aggregated results, with point estimates and 95% confidence intervals within the same cell value, by aggregation specified or overall.
## Not run: analyse_survey_results(df = proc_mortality1, ratios_tates.numerators = c(deaths, under5_deaths),
ratios_rates.denominators = c(persontime, under5_persontime), ratios_rates_multiplier = 10000
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.