In my dataset, I have 208 weeks of weekly sales, advertising, and display data. I'm currently trying to create a dummy variable in R that indicates whether a certain event has happend in one (or more) of those weeks for a certain product category, where the dummy has a value of 1 for weeks 40,41, and 42 in my dataset. I have figured out how to get it to work for just week 40 but have been unable to get R to give a value of 1 to all three weeks. The command I used looks as follows:
DatasetThesis$DummyVariable66 <- ifelse(DatasetThesis$Category==66&DatasetThesis$Week==40, 1, 0)
I have tried several operators in my command such as '&', and '|' but those commands did not work.
I'm hoping you guys can help me out.