abridge: Abridge a 'demog_change_component_df' object

View source: R/S3_classes_demog_change_component_utility_functions.R

abridgeR Documentation

Abridge a demog_change_component_df object

Description

This is a generic function with methods for the various sub-classes of ccmpp_input_df. It abridges the first argument, x, such that the result has spans or ages and times as supplied in the span_abridged, age_start_abridged and time_start_abridged arguments. See “Details” for restrictions on specifying the arguments.

Usage

abridge(x, ...)

## S3 method for class 'demog_change_component_df'
abridge(
  x,
  age_span_abridged = NULL,
  time_span_abridged = NULL,
  age_start_abridged = NULL,
  time_start_abridged = NULL,
  out_class = class(x)[1],
  ...
)

Arguments

x

An object inheriting from demog_change_component_df.

...

Other arguments passed to other methods.

age_span_abridged

A numeric scalar giving the new age_span values; x will be abridged such that it's age_span is age_span_abridged.

time_span_abridged

As age_span_abridged but for time.

age_start_abridged

Vector of new age_start values; x will be abridged such that age_start_abridged defines the new age groups.

time_start_abridged

As age_start_abridged but for time.

out_class

See same argument for aggregate.demog_change_component_df.

Details

If you specify age_span_abridged you cannot specify age_start_abridged, and similarly for time_span_abridged and time_start_abridged. If you specify only one of “age” and “time”, all levels of the other are kept if x has the corresponding demographic dimension. Moreover, abridging is done within levels of “sex” and “indicators” if x has those dimensions.

This function calls aggregate.data.frame to do the actual abridging.

If you get an error along the lines of “result is invalid as a member of the class” or similar, it means that, after abridging, the result is no longer valid as a member of the class x has. This would occur, for example, if x inherits from ccmpp_input_df and you only supplied one of the ..._start_abridged arguments. Try supplying both or, instead, specify span_abridged.

Value

An object of the same class as x, abridged.

Author(s)

Mark Wheldon

See Also

aggregate which this function relies on, link{collapse_demog_dimension} for a related function.


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