Read data directly from HMD and construct a vital
object for use in other functions
Source: R/hmd.R
read_hmd.Rd
read_hmd
reads single-year and single-age data from the Human Mortality Database (HMD
https://www.mortality.org) and constructs a vital
object suitable
for use in other functions. This function uses HMDHFDplus::readHMDweb()
to download the required data. It is designed to handle Deaths, Population,
Exposure, Death Rates and Births. By default, Deaths, Population, Exposure
and Death Rates are downloaded. It is better to handle Births separately as
they are not age-specific.
Usage
read_hmd(
country,
username,
password,
variables = c("Deaths", "Exposures", "Population", "Mx")
)
Arguments
- country
Directory abbreviation from the HMD. For instance, Australia = "AUS".
- username
HMD username (case-sensitive)
- password
HMD password (case-sensitive)
- variables
List of variables to download from the HMD. If the data contains a mixture of age-specific and non-age-specific variables, then the non-age-specific data will be repeated for each age.
Details
In order to read the data, users are required to create an account with the HMD website (https://www.mortality.org), and obtain a valid username and password.