View source: R/format_results_long.R
format_results_long | R Documentation |
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.
format_results_long(df, vars, not_proportions)
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. |
Returns a dataframe of the reshaped results with point.estimates and confidence intervals in the same cells, and one column for each variable included.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.