I have a dataframe Events that looks like this
EventCount Date
3317 2015-01-05
3388 2015-01-12
3467 2015-01-19
3455 2015-01-26
3506 2015-02-02
3561 2015-02-09
What I want is to create a new column 'EventType', based on which week the event took place. Those that took place before 2015-01-12 are of type A, between 2015-01-12 and 2015-02-02 are of type B and after 2015-02-02 are of type C.
What I tried is using the ifelse condition to create a new column.
Events$EventType<-ifelse(Events$Date < as.Date('2015-02-02'),"B","C")
This gives me a new column that categorizes by only two conditions, and not three.