starschemar (version 1.2.0)

updates_st_mrs_age: Updates for the Star Schema for Mortality Reporting System by Age

Description

Example of updates on some dimensions of the star schema for Mortality Reporting System by age.

Usage

updates_st_mrs_age

Arguments

Format

A record_update_set object.

Examples

Run this code
# NOT RUN {
# Defined by:

library(tidyr)

(dim_names <- st_mrs_age %>%
    get_dimension_names())

where <- st_mrs_age %>%
  get_dimension("where")

when <- st_mrs_age %>%
  get_dimension("when")

who <- st_mrs_age %>%
  get_dimension("who")

updates_st_mrs_age <- record_update_set() %>%
  update_selection_general(
    dimension = where,
    columns_old = c("state", "city"),
    old_values = c("CT", "Bridgepor"),
    columns_new = c("city"),
    new_values = c("Bridgeport")
  ) %>%
  match_records(dimension = when,
                old = 37,
                new = 36) %>%
  update_record(
    dimension = when,
    old = 73,
    values = c("1962-02-17", "07", "1962")
  ) %>%
  update_selection(
    dimension = who,
    columns = c("age_range"),
    old_values = c("<1 year"),
    new_values = c("1: <1 year")
  ) %>%
  update_selection(
    dimension = who,
    columns = c("age_range"),
    old_values = c("1-24 years"),
    new_values = c("2: 1-24 years")
  ) %>%
  update_selection(
    dimension = who,
    columns = c("age_range"),
    old_values = c("25-44 years"),
    new_values = c("3: 25-44 years")
  ) %>%
  update_selection(
    dimension = who,
    columns = c("age_range"),
    old_values = c("45-64 years"),
    new_values = c("4: 45-64 years")
  ) %>%
  update_selection(
    dimension = who,
    columns = c("age_range"),
    old_values = c("65+ years"),
    new_values = c("5: 65+ years")
  )

# }

Run the code above in your browser using DataLab