guess_span_for_dimension: Guess the "span" for a demographic dimension

guess_span_for_dimensionR Documentation

Guess the “span” for a demographic dimension

Description

guess_span_from_start takes a vector of “_start” values as first argument; guess_span_for_dimension_for_df is a convenience wrapper that takes a data frame with such a column instead.

Usage

guess_span_from_start(x, span_name = character())

guess_span_for_dimension_for_df(x, dimension = get_all_dimensions_w_spans())

Arguments

x

Vector of “start” values (e.g., the time_start or age_start column from a demog_change_component_df object).

dimension

A single demographic dimension with a “span” (e.g., “age”, “time”).

Details

Certain demographic dimensions, such as “time” and “age” have associated spans. These should ordinarily be supplied by the user when calling, e.g., demog_change_component_df, but a very simple guess will be attempted if not. Generally, the smallest difference between successive values in the corresponding “_start” column will be returned. However, if there is only one unique “_start” value, all 1 will be returned and a warning issued.

Value

Guessed span.

Author(s)

Mark Wheldon


markalava/ccmppWPP documentation built on April 21, 2022, 12:36 a.m.