get_names: Get HWI/HWIG names

View source: R/hwig.R

get_namesR Documentation

Get HWI/HWIG names

Description

Helper function, to return names of each matrix

Usage

get_names(DT, by)

Arguments

DT

input group membership data, in individual/group format

by

column(s) to split calculation by. e.g.: year

Value

names corresponding to values of by for each of the returned list of matrices in calc_hwi and calc_hwig.

See Also

calc_hwi calc_hwig

Examples

# Load data.table
library(data.table)

# Load example data
DT <- fread(system.file("extdata", "DT.csv", package = "hwig"))

# Calculate HWI
hwi <- calc_hwi(DT, 'id', 'group', 'yr')

# Calculate HWIG
hwig <- calc_hwig(hwi)

# Set names
nms <- get_names(DT, 'yr')
names(hwig) <- nms

robitalec/hwig documentation built on March 5, 2023, 10:24 a.m.