Read year week as Date for Time series

Thank you Alexis. It is highly helpful. One query though, how do we suppose to convert it into a time series object by keeping the same week numbers. Because we supposed to mention the frequency on the TS object(like frequency =52 or 52.18) for weekly data, is there any possibility for a Time series object to have 53 weeks in one year(2020) and 52 weeks in other years(2019.2021).

I have used the frequency as 52.18(365.25/7) on the time series object and when I checked the index week, it seems like it does consider 53 weeks for 2020 and 52 weeks for 2019,2020 without using the isoweek. Is this correct?

Mydf2<- Mydf[,c("Shipment","Production","Net.Production.Qty")]
Mydf.ts<-ts(Mydf2,frequency = 365.25/7,start = c(2019,1))
check<- as_tsibble(Shipment.ts) %>%
        mutate(Date.Week= as_date(index)) %>%
        as_tibble()
View(check)
1 Like