I’m in the middle of the data cleaning for TSR, and my problem is as to binding, joining, or merging daily confounders and exposure variables to weekly case report darasetes for TSR.
In the first place, I created weekly mean datasets of all the variables by using lubridate for TSR, but it didn’t work well when conducting TSR.
Now I create daily datasets of confounders and exposure variables and run TSR. It worked. However, I have no idea how to put together, weekly and daily datasets for TSR.
Please give some feedback.
This is my code for TSR of daily datasets. It did work.
However, I have case report datasets that give only “Week of the Year” and values.
My aim is to conduct TSR based on weekly (WOY) datasets.
tsday1<-day1%>%
as_tibble()%>%
mutate(year=as.numeric(format(date,"%Y")),
month=as.numeric(format(date,"%m")),
dow=as.factor(format(date,"%a")),
WOY=as.factor(format(date, format="%Y-%U")),
time=1:nrow(.),
season=ifelse(month %in% 4:9,1, 2),
season=factor(season,levels=c(1,2),labels=c("warm","cold")))
堤美央 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.