Lab 1 Data Type Issue
nerea88 opened this issue · 1 comments
I am having issues working with the data when brought into markdown. It is brought in as a list and seems like it needs to be another format to run the time series model. I have tried a few different ways:
p2 <- as.data.frame(passengers)
p3 <- as.numeric(as.character(unlist(passengers[1:365])))
But I still get this error when I try to run the time series model:
Error in model.frame.default(formula = p3 ~ time + treatment + timesince, : invalid type (list) for variable 'time'
I feel as if I am missing something potentially simple but haven’t been able to formulate and search the right questions to figure this out. Any help would be appreciated.
Thanks,
Nick
Passengers is a vector. So you need to build a dataframe with all the variables, or make each variable its separate numeric vector.
For time just do
Time <- 1:365
Then use the time variable to create treatment and time since.
Hope that helps