get_names {hwig} | R Documentation |
Helper function, to return names of each matrix
get_names(DT, by)
DT |
input group membership data, in individual/group format |
by |
column(s) to split calculation by. e.g.: year |
names corresponding to values of by for each of the returned list of matrices in calc_hwi and calc_hwig.
# 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