knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

The goal of champsmortality is to provide functions for calculating factor-adjusted mortality fractions and rates at CHAMPS sites and catchments for various causes.

Installation

You can install the development version of champsmortality with the following:

install.packages("remotes") # one time only
remotes::install_github("ki-tools/champs-mortality")

Once installed, load the library:

library(champsmortality)

Data setup

The first time you use this package, you need to place the appropriate data files in a data directory that the package will pull from to perform the calculations. A function create_dataset_directory() is provided to help get this set up.

Here we will create the dataset directory in a temporary location.

data_dir <- tempfile()
create_dataset_directory(data_dir)

As long as you maintain the specified directory on your computer, you do not need to run this command again. We recommend choosing a persistent directory.

This creates the directory and copies some data files over that come with the package:

list.files(data_dir)

These files come with the package. They will be described in greater detail in the next article.

The config.yaml file contains pointers to each dataset that is required for analysis:

cat(paste(readLines(file.path(data_dir, "config.yaml")), collapse = "\n"))

Each entry specifies the file name of each required data file. Note the three datasets that already exist and an additional 5 that don't come with the package due to their sensitive nature. These datasets can be obtained from CHAMPS and more information about their contents and structure will be provided in the next section.



ki-tools/champs-mortality documentation built on Oct. 9, 2022, 6:32 a.m.