proxy_test <- data.frame(
id = c(
rep(3051, 4),
rep(7835,3),
rep(9891,3),
rep(1236,3)
),
provider = c(
rep("QKJ", 4),
rep("JSD",3),
rep("YJG",3),
rep("LJG",3)
),
spell_start = as.Date(c(
"2020-07-03", "2020-07-14", "2020-07-23", "2020-08-05",
"2020-11-01", "2020-11-13", "2020-12-01",
"2020-03-28", "2020-04-06", "2020-04-09",
"2020-10-06", "2020-11-05", "2020-12-25"
)),
spell_end = as.Date(c(
"2020-07-11", "2020-07-22", "2020-07-30", "2020-07-30",
"2020-11-11", NA, "2020-12-03",
"2020-03-28", NA, "2020-04-09",
"2020-10-06", "2020-11-05", NA
)),
disdest = c(
19, 19, 51, 19,
19, 19, 19,
51, 98, 19,
19, 19, 98
)
)
proxy_episode_dates(
x=proxy_test,
group_vars = c('id','provider'),
spell_start_date = 'spell_start',
spell_end_date = 'spell_end',
discharge_destination = 'disdest'
)[]
Run the code above in your browser using DataLab