get_names: Get HWI/HWIG names

Description Usage Arguments Value See Also Examples

View source: R/hwig.R

Description

Helper function, to return names of each matrix

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# 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

hwig documentation built on Sept. 30, 2021, 5:08 p.m.