library("data.table")
strategies <- data.table(
strategy_id = c(1, 2),
strategy_name = c("Strategy 1", "Strategy 2")
)
patients <- data.table(
patient_id = seq(1, 4),
age = c(50, 55, 60, 65),
grp_id = c(1, 1, 2, 2),
grp_name = rep(c("Age 50-59", "Age 60-69"), each = 2)
)
states <- data.table(
state_id = seq(1, 2),
state_name = c("State 1", "State 2")
)
hesim_dat <- hesim_data(
strategies = strategies,
patients = patients,
states = states
)
labs <- get_labels(hesim_dat)
labs
# Pass to set_labels()
d <- data.table(strategy_id = c(1, 1, 2, 2),
grp_id = c(1, 2, 1, 2))
set_labels(d, labs, new_name = c("strategy_name", "grp_name"))
d
Run the code above in your browser using DataLab