format_results_long: Format Results Long Helper function

View source: R/format_results_long.R

format_results_longR Documentation

Format Results Long Helper function

Description

This function takes the output of srvyr summary analysis that uses vartype = "ci", and reformats the results so the point estimate and confidence intervals are presented in a single cell together.

Usage

format_results_long(df, vars, not_proportions)

Arguments

df

Inputs a dataframe that contains aggregated results from a srvyr summary. There should be columns included for point.estimate, lower_ci, and upper_ci.

vars

Inputs a character vector specifying the names of the columns to be reshaped, including the point.estimate and lower_ci and upper_ci columns. Should not include the grouping column.

not_proportions

Inputs a character vector specifying the names of the columns that are not proportions, as proporiton results will be multiplied by 100 within the function, and confidence intervals limited to 0 and 100.

Value

Returns a dataframe of the reshaped results with point.estimates and confidence intervals in the same cells, and one column for each variable included.

Examples

## Not run: format_results_long(df = myresults, vars = c("variable1",
"variable1_low", "variable1_upp", "variable2", "variable2_low", "variable2_upp"),
not_proportions = c("avg_hh_size", "num_children_under5"))
## End(Not run)


SaeedR1987/healthyr documentation built on July 4, 2023, 11:17 p.m.