View source: R/user_standardize_samples.R
| standardize_samples | R Documentation |
Age-standardizes samples using a standard population.
standardize_samples(
sample,
std_pop,
margin,
groups = NULL,
bind_new = FALSE,
new_name = NULL
)
sample |
an |
std_pop |
A vector of standard populations. |
margin |
For |
groups |
A vector of either indices for each group or a vector of strings for each group name. If set to |
bind_new |
If set to |
new_name |
The name to assign to the age-standardized group. |
An array of age-standardized samples.
std_pop <- c(113154, 100640, 95799)
age_margin <- 2
# age-standardize by all age groups
samples_3564 <- standardize_samples(minsample, std_pop, age_margin)
# age-standardize only by the first two age groups
samples_3554 <- standardize_samples(minsample, std_pop[1:2], age_margin, groups = 1:2)
# bind age-standardized samples to original samples
samples_as <- standardize_samples(
minsample,
std_pop,
age_margin,
bind_new = TRUE,
new_name = "35-64"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.