r - Subset data frame for specific dates -


i have data frame one

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) 

i want subset these dates

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') 

is clumsy solution.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -