subset_time.death_count_age_sex | R Documentation |
These functions subset objects inheriting from
demog_change_component_df
by one of the four dimensions,
indicator, age, time, or sex, and retain the class if valid (see
“Details”). Subsetting such that only one level of the
subset dimension is retained will drop the dimension if drop
= TRUE
, otherwise it is retained (default). If the object returned
after subsetting is a valid member of the original class it will be
returned (valid according to
validate_ccmppWPP_object
). If it is not valid an error
will be signalled and nothing is returned.
## S3 method for class 'death_count_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'death_count_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'death_count_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'death_probability_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'death_probability_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'death_probability_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'ccmpp_input_df' subset_indicator(x, indicators, include = TRUE) ## S3 method for class 'ccmpp_input_df' subset_time(x, times, include = TRUE) ## S3 method for class 'ccmpp_input_df' subset_age(x, ages, include = TRUE) ## S3 method for class 'ccmpp_input_df' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'fert_rate_age_f' subset_time(x, times, include = TRUE) ## S3 method for class 'fert_rate_age_f' subset_age(x, ages, include = TRUE) ## S3 method for class 'life_table_age_sex' subset_indicator(x, indicators, include = TRUE) ## S3 method for class 'life_table_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'life_table_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'life_table_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'mig_net_count_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'mig_net_count_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'mig_net_count_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'mig_net_count_tot_b' subset_time(x, times, include = TRUE) ## S3 method for class 'mig_net_rate_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'mig_net_rate_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'mig_net_rate_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'mig_parameter' subset_time(x, times, include = TRUE) ## S3 method for class 'mig_parameter' subset_indicator(x, times, include = TRUE) ## S3 method for class 'mort_rate_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'mort_rate_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'mort_rate_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'pop_count_age_sex_base' subset_time(x, times, include = TRUE) ## S3 method for class 'pop_count_age_sex_base' subset_age(x, ages, include = TRUE) ## S3 method for class 'pop_count_age_sex_base' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'srb' subset_time(x, times, include = TRUE) ## S3 method for class 'survival_ratio_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'survival_ratio_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'survival_ratio_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'ccmpp_output_df' subset_indicator(x, indicators, include = TRUE) ## S3 method for class 'ccmpp_output_df' subset_time(x, times, include = TRUE) ## S3 method for class 'ccmpp_output_df' subset_age(x, ages, include = TRUE) ## S3 method for class 'ccmpp_output_df' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'pop_count_age_sex' subset_time(x, times, include = TRUE) ## S3 method for class 'pop_count_age_sex' subset_age(x, ages, include = TRUE) ## S3 method for class 'pop_count_age_sex' subset_sex(x, sexes, include = TRUE) ## S3 method for class 'pop_count_age_sex_reference' subset_time(x, times, include = TRUE) ## S3 method for class 'pop_count_age_sex_reference' subset_age(x, ages, include = TRUE) ## S3 method for class 'pop_count_age_sex_reference' subset_sex(x, sexes, include = TRUE) subset_time(x, times, include = TRUE, ...) ## S3 method for class 'demog_change_component_df' subset_time(x, times, include = TRUE, drop = FALSE) subset_age(x, ages, include = TRUE, ...) ## S3 method for class 'demog_change_component_df' subset_age(x, ages, include = TRUE, drop = FALSE) subset_sex(x, sexes, include = TRUE, ...) ## S3 method for class 'demog_change_component_df' subset_sex(x, sexes = get_all_allowed_sexes(), include = TRUE, drop = FALSE) subset_indicator(x, indicators, include = TRUE, ...) ## S3 method for class 'demog_change_component_df' subset_indicator(x, indicators, include = TRUE, drop = FALSE)
x |
An object to subset. |
include |
Logical; should the rows corresponding to the values supplied in the previous argument be those that are kept or discarded? |
indicators, times, ages, sexes |
Vectors indicating the levels of
time, age, or sex to retain ( |
drop |
Logical; should demographic change component dimensions with only one level be dropped? Not available in all methods; see “Details”. |
For subset_times
and subset_ages
rows can be excluded
by supplying negative times
or ages
. In
that case, all values must be negative and include
must be
TRUE
(the default). Violations will result in an error.
Argument drop
is not available in the methods for objects
inheriting from ccmpp_input_df
because these objects must
have (and keep) the set of dimensions specified in their class
definition. E.g., fert_rate_input
objects may be subset by
time, but the time dimension cannot be dropped because objects of
this class must always have a time dimension.
The object after subsetting if a valid member of the class; otherwise an error.
These functions are not particularly efficient. For repeated subsetting within, e.g., a for loop, it is better to use standard subsetting operations on the data frame component and re-cast the result as a classed object at the end if desired.
Mark Wheldon
Other subset_by_demographic_dimension:
subset_ccmpp_input_list
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.