The attached is the data frame I am dealing with.
The first column in the data frame is the Date. I have to subset data frame based on condition on multiple months and years. For example, I want all July and September months data for the years 2005 and 2006.
I tried following code:
output <- subset(df, format.Date(Date, "%m")==c("07", "09") & format.Date(Date, "%Y")==c("2005","2006"))
The above code results the unexpected output.
I found posts regarding this problem but those were only for single month and year.