Functions to create, import, and access standardization reference populations. Create a Standardization Reference from User Data

createStandardizationReference(
  name,
  country,
  year,
  source,
  data,
  reference = NULL
)

Arguments

name

Character. Name of the reference population

country

Character. Country or region

year

Integer. Reference year

source

Character. Data source description or citation

data

Data frame with columns: age, gender, population

reference

Character. URL or reference to access the source data (optional)

Value

StandardizationReference object

Details

The data frame should have one row per age-gender combination. Population values should be absolute counts (not proportions). Weights are automatically calculated as population / total_population.

Examples

if (FALSE) {
  my_data <- data.frame(
    age = c("0", "1-4", "5-9", "10-14", "0", "1-4", "5-9", "10-14"),
    gender = c(rep("Male", 4), rep("Female", 4)),
    population = c(100000, 400000, 420000, 410000, 95000, 380000, 400000, 405000)
  )

  my_ref <- createStandardizationReference(
    name = "Custom Census",
    country = "Fictional Country",
    year = 2020,
    source = "My Data Collection",
    data = my_data
  )
}