2
取两个区间:[1,6]和[6,12]。 6号属于第二个,但不是第一个。同样可以在lubridate中完成吗? (This涉及Python中的问题...)R的独特时间间隔
library(lubridate)
date1 <- ymd(20010101); date3 <- ymd(20010103); date6 <- ymd(20010106); date12 <- ymd(20010112)
intA <- new_interval(date1, date6); intB <- new_interval(date6, date12)
date3 %within% intA
> TRUE
date3 %within% intB
> FALSE
date6 %within% intB ## I want this to be true
> TRUE
date6 %within% intA ## but this be false...
> TRUE
可以起到%以内%进行调整,以排除区间的上限?
任何帮助将不胜感激。
感谢@Gregor,你是男人! – emagar 2014-12-03 21:38:20