I'm having issues figuring out how to create the variables "Treatment" and "TimeSince" for the dataset without manually entering in each piece of data. I've tried several different ways to show Treatments 1:120 as "0" and 121:365 as "1" but I continue to get errors. Additionally, I cannot figure out how to code the "TimeSince" variable. Any help is appreciated.
I'm having issues figuring out how to create the variables "Treatment" and "TimeSince" for the dataset without manually entering in each piece of data. I've tried several different ways to show Treatments 1:120 as "0" and 121:365 as "1" but I continue to get errors. Additionally, I cannot figure out how to code the "TimeSince" variable. Any help is appreciated.
Time <- c(1:365)
Treatment <- as.numeric(1:365 & 1:120==0, 121:365==1)
bus_data <- data.frame(passengers, Time, Treatment)
bus_data