This script implements a workflow for death counts from vr or census extracting data from Demodata, harmonizing age groups, identifying full series, selecting preferred series, validating totals by age and by sex and eventually, including key fields in the function output.

DDharmonize_validate_DeathCounts(
  locid,
  times,
  process = c("census", "vr"),
  return_unique_ref_period = TRUE,
  DataSourceShortName = NULL,
  DataSourceYear = NULL,
  retainKeys = FALSE,
  server = "https://popdiv.dfs.un.org/DemoData/api/"
)

Arguments

locid

Location id

times

The period of the data to be extracted. You can extract one year data e.g times = 2020 or a longer period of time e.g times = c(1950, 2020).

process

The process through which the data was obtained from various sources i.e either via census or vital registrations (vr). By default, the function pulls data obtained through both of these processes.

return_unique_ref_period

TRUE/FALSE. Specifies whether the data to be returned should contain one unique id (return_unique_ref_period == TRUE) or several ids (return_unique_ref_period == FALSE) per time label. ids are a unique identifier for each unique set of records based on LocID, LocName, DataProcess, ReferencePeriod, DataSourceName, StatisticalConceptName, DataTypeName and DataReliabilityName. The definitions of these variables are provided later in this article.

DataSourceShortName

NULL

DataSourceYear

NULL

retainKeys

TRUE/FALSE. Specifies whether only a few (retainKeys == FALSE) or all (retainKeys == TRUE) variables should be retained in the output.

server

"https://popdiv.dfs.un.org/DemoData/api/"

Value

A harmonized dataset containing death counts

Details

See the DDharmonize_validate_DeathCounts vignette for more details about this function.

Examples

if (FALSE) {
kenya_df <- DDharmonize_validate_DeathCounts(404,
                                              c(1950,2020),
                                              process = c("census", "vr"),
                                              return_unique_ref_period = TRUE,
                                              DataSourceShortName = NULL,
                                              DataSourceYear = NULL,
                                              retainKeys = FALSE,
                                              server = "https://popdiv.dfs.un.org/DemoData/api/")
}