df <- data.frame(
ptid = c(round(runif(25,1,5))),
spec = sample(c("KLEBSIELLA SP",
"KLEBSIELLA UNNAMED",
"KLEBSIELLA PNEUMONIAE",
"KLEBEIELLA OXYTOCA"),
25,replace = TRUE),
type = "BLOOD",
specdate = sample(seq.Date(Sys.Date()-21,Sys.Date(),"day"),25,replace = TRUE)
)
respeciate_generic(x=df,
group_vars=c('ptid','type'),
species_col='spec',
date_col='specdate',
window = 14)[]
Run the code above in your browser using DataLab