case_number <- c("1", "1", "2", "2", "2", "3", "3")
type <- c("STD", "STD2", "STD", "STD3", "STD2", "STD", "STD2")
date <- as.Date(c('2008-11-1','2009-3-25','2010-3-14',"2010-10-14","2010-11-14", '2015-3-14', '2015-4-15'))
data <- data.frame(case_number,type, date)
我想知道如何提取独特的case_number
其中包含STD
and STD2
按日期排序?
在这种情况下,它将是 1 和 3,因为对于 2,STD3
发生在之间STD1
and STD2
.