derive_pct_est_moe | R Documentation |
A function to calculate the margin of error for proportions or ratios of tidycensus ACS dataframes, which are not included by default. Dataset should be structured with an aggregate column and margin of error uniform across rows, and a column for component values/margins of error. Formula construction follows ACS guidance in "Understanding and Using ACS Data," available here: https://www.census.gov/programs-surveys/acs/guidance/handbooks/general.html.
derive_pct_est_moe( df, proportion_col, aggregate_est, aggregate_moe, component_est = "estimate", component_moe = "moe", type_moe = "proportion" )
df |
A tidycensus ACS dataframe with rows representing component values and a column with a common group total. |
proportion_col |
The name of the proportion column to create |
aggregate_est |
A column representing an aggregate total for the group; the denominator in the proportion |
aggregate_moe |
A column representing the margin of error for the aggregate estimate |
component_est |
A column representing the value of the component value for which a proportion is being calculated; the numerator in the proportion |
component_moe |
A column representing the marging of error of the component value |
type_moe |
"proportion" or "ratio" for whether a proportion or ratio is being constructed |
A tidycensus dataframe with a calculated proportion or ratio and its margin of error.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.