I have a dataframe where the first column is a date in d/m/y format and the second is a numeric value (sales).
I want to create subsets for each month of one year (eg. 11/11, 12/11 etc). I tried the code suggested in this answer: subset a data.frame with multiple conditions
and it works when the condition on the month is imposed:
subset(sales, format.Date(date, "%m")=="11")
but it returns an empty subset with error message invalid 'x' argument
when I add the year condition:
subset(sales, format.Date(date, "%m")=="11" & format.Date(date, "%y")=="11")
I am using R 2.10.1-2 on Ubuntu 10.04, thanks for the help you can give.
See Question&Answers more detail:os