Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个像这样的数据框
yr06 = as.Date("2006-07-01")+0:100 yr07 = as.Date("2007-07-11")+0:108 Date = c(yr06,yr07) Data = c(0:100,0:108) df = data.frame(Date,Data)
我只想为这些日期设置子集
D6 = as.Date("2006-08-20")+0:38 D7 = as.Date("2007-08-20")+0:44
sub.df = subset(df, as.Date(Date) >= '2006-08-20' & as.Date(Date) <= '2006-09-27' | as.Date(Date) >= '2007-08-20' & as.Date(Date) <= '2007-10-03')
是我笨拙的解决方案。