demog_change_component_df: Constructor for class 'demog_change_component_df'

View source: R/S3_classes_demog_change_component_df.R

demog_change_component_dfR Documentation

Constructor for class demog_change_component_df

Usage

demog_change_component_df(
  x,
  value_type = attr(x, "value_type"),
  value_scale = attr(x, "value_scale"),
  ...
)

## S3 method for class 'summary_fert_rate_age_f'
print(x, vsep, ..., print_what = c("info", "table"))

Arguments

x

For demog_change_component_df: A data frame with columns “age_start”, “age_span”, “sex”, “time_start”, “time_span”, and “value”.

value_type

Scalar indicating the type of the “value” column (e.g., “count”, “rate”, etc.).

value_scale

Numeric scalar indicating the value_scale of the counts, e.g., 1, 1000, 1e6, etc.

...

Passed to the low-level constructor.

Details

demog_change_component_df is the parent class of a family of classes for holding age- time-specific demographic vital rates, such as fertility and mortality rates, population counts, and migration rates. It is not intended as a class for raw data; only one value per age and period is permitted. Rather, it is intended to be useful to ensure that objects passed to functions that expect demographic values as input are correctly formatted.

Objects of this class have class attribute c("demog_change_component_df", "data_frame").

The class is based on a data frame with age-sex-specific vital rates for one or more time periods in a column named “value”.

See the help files for the other constructor functions under “See also” for further details specific to each type of vital rate or parameter.

Value

An object of class demog_change_component_df.

Class Definition

**TBC** (details of the class) 1. Must be sorted properly.

Attributes of objects with this class

**TBC**

**ISSUES OUTSTANDING** ======================

SORTING: ——–

Correct ordering by 'age_start' and 'time_start' is required for the ccmpp functions (right?) What about by 'sex'? The sample inputs are sorted by sex first (varying slowest) but with 'male' first, so in reverse alphabetical order.

FACTORS vs CHARACTERS: ———————–

'sex' is a categorical variable and encoding it as a factor could be justified. However it may be easier to encode as character and have methods convert to factor when advantageous. NOTE that ordering is important; see 'sex_as_factor()' and friends.

Author(s)

Mark Wheldon


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