| Title: | Tidy Epidemiological Rates |
|---|---|
| Description: | Compute age-adjusted rates by direct and indirect methods and other epidemiological indicators in a tidy way, wrapping functions from the 'epitools' package. |
| Authors: | Raphael Saldanha [aut, cre] (ORCID: <https://orcid.org/0000-0003-0652-8466>) |
| Maintainer: | Raphael Saldanha <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.1 |
| Built: | 2026-05-25 09:52:55 UTC |
| Source: | https://github.com/rfsaldanha/tidyrates |
Fleiss dataset from epitools package examples, with event counts and population per age group in tidy format.
fleiss_datafleiss_data
An object of class tbl_df (inherits from tbl, data.frame) with 60 rows and 4 columns.
Computes direct adjusted rates and confidence intervals.
rate_adj_direct( .data, .std, .keys = NULL, .name_var = "name", .value_var = "value", .age_group_var = "age_group", .age_group_pop_var = "population", .events_label = "events", .population_label = "population", .progress = TRUE )rate_adj_direct( .data, .std, .keys = NULL, .name_var = "name", .value_var = "value", .age_group_var = "age_group", .age_group_pop_var = "population", .events_label = "events", .population_label = "population", .progress = TRUE )
.data |
A tibble containing events counts and population per groups (e.g. age groups) |
.std |
A vector with standard population values for each group |
.keys |
Optional. A character vector with grouping variables, like year and region code. |
.name_var |
Variable containing variable names. Defaults to |
.value_var |
Variable containing values. Defaults to |
.age_group_var |
Variable name of age groups. Defaults to |
.age_group_pop_var |
Variable name of population size on |
.events_label |
Label used for events at the |
.population_label |
Label used for population at the |
.progress |
Whether to show a progress bar. Defaults to |
This functions wraps the epitools ageadjust.direct function to compute direct adjusted rates and "exact" confidence intervals using tibble objects with multiple grouping keys.
A tibble (.data) must be informed containing key variables like year and region code, and population and and events count (e.g. cases) per age group. Check the fleiss_data for an example.
A tibble (.std) must be also supplied containing the age groups and population size. By default, this tibble has two variables, named age_group and pop.
A tibble with crude and adjusted rate, lower and upper confidence intervals.
standard_pop <- tibble::tibble( age_group = c("Under 20", "20-24", "25-29", "30-34", "35-39", "40 and over"), population = c(63986.6, 186263.6, 157302.2, 97647.0, 47572.6, 12262.6) ) rate_adj_direct(fleiss_data, .std = standard_pop)standard_pop <- tibble::tibble( age_group = c("Under 20", "20-24", "25-29", "30-34", "35-39", "40 and over"), population = c(63986.6, 186263.6, 157302.2, 97647.0, 47572.6, 12262.6) ) rate_adj_direct(fleiss_data, .std = standard_pop)
Computes indirect adjusted rates and confidence intervals.
rate_adj_indirect( .data, .std, .keys = NULL, .name_var = "name", .value_var = "value", .age_group_var = "age_group", .age_group_pop_var = "population", .events_label = "events", .population_label = "population", .progress = TRUE )rate_adj_indirect( .data, .std, .keys = NULL, .name_var = "name", .value_var = "value", .age_group_var = "age_group", .age_group_pop_var = "population", .events_label = "events", .population_label = "population", .progress = TRUE )
.data |
A tibble containing events counts and population per groups (e.g. age groups) |
.std |
A vector with standard population values for each group |
.keys |
Optional. A character vector with grouping variables, like year and region code. |
.name_var |
Variable containing variable names. Defaults to |
.value_var |
Variable containing values. Defaults to |
.age_group_var |
Variable name of age groups. Defaults to |
.age_group_pop_var |
Variable name of population size on |
.events_label |
Label used for events at the |
.population_label |
Label used for population at the |
.progress |
Whether to show a progress bar. Defaults to |
This functions wraps the epitools ageadjust.indirect function to compute indirect adjusted rates and "exact" confidence intervals using tibble objects with multiple grouping keys.
A tibble (.data) must be informed containing key variables like year and region code, and population and and events count (e.g. cases) per age group. Check the fleiss_data for an example.
A tibble (.std) must be also supplied containing the age groups, events and population size. By default, this tibble has three variables, named age_group, name and value. Check the selvin_data_1940 for an example.
A tibble with crude and adjusted rate, lower and upper confidence intervals.
rate_adj_indirect(.data = selvin_data_1960, .std = selvin_data_1940)rate_adj_indirect(.data = selvin_data_1960, .std = selvin_data_1940)
This table present standard population reference for age groups from SEER*Stat WHO adjusted proportions.
seer_std_popseer_std_pop
An object of class tbl_df (inherits from tbl, data.frame) with 21 rows and 2 columns.
Selvin dataset from epitools package examples for 1940, with event counts and population per age group in tidy format.
selvin_data_1940selvin_data_1940
An object of class tbl_df (inherits from tbl, data.frame) with 22 rows and 3 columns.
Selvin dataset from epitools package examples for 1960, with event counts and population per age group in tidy format.
selvin_data_1960selvin_data_1960
An object of class tbl_df (inherits from tbl, data.frame) with 22 rows and 3 columns.
This table present standard population reference for age groups from the World Health Organization (WHO).
who_std_popwho_std_pop
An object of class tbl_df (inherits from tbl, data.frame) with 21 rows and 2 columns.