load_hmd_lifetab: Load HMD data for background survival

View source: R/load_hmd_lifetab.R

load_hmd_lifetabR Documentation

Load HMD data for background survival

Description

A wrapper function for HMDHFDplus::readHMDweb to load HMD data (both male and female) for the first time. If a file for the year (based on Sys.Date()) already exists, the download is skipped. Updates can be forced with force_update = TRUE. See https://towardsdatascience.com/using-dotenv-to-hide-sensitive-information-in-r-8b878fa72020 how to set and load environment data for username and password.

Usage

load_hmd_lifetab(
  path_to_file = "data/hmd/",
  force_update = FALSE,
  country = "NLD",
  hmd_user = Sys.getenv("HMD_USER"),
  hmd_password = Sys.getenv("HMD_PW")
)

Arguments

path_to_file

A character for path to file. Default is "data/hmd/". File name will be given automatically.

force_update

If TRUE update will be forced (i.e. new download).

country

Country for which HMD data should be downloaded. Default is "NL".

hmd_user

HMD username.


fthielen/tatooheen documentation built on Nov. 8, 2023, 4:37 a.m.