I have the weekly
data:
weekly <- structure(list(date = c("2013-01-07", "2013-01-10", "2013-01-21",
"2018-01-23", "2018-02-00", "2013-02-11", "2013-02-13", "2013-02-25",
"2013-03-00", "2013-03-11", "2013-03-13", "2013-03-25", "2018-00-01",
"2018-00-08", "2018-00-15", "2018-00-22", "2018-00-29", "2018-05-06",
"2018-05-13"), count = c(1750L, 1993L, 1816L, 1264L, 2042L, 1989L,
2186L, 2118L, 2081L, 2110L, 2151L, 2069L, 1898L, 1862L, 1952L,
1891L, 1758L, 1169L, 2009L)), row.names = c(NA, -19L), class = "data.frame")
I want to convert this data to the time series ts
object so that I can forecast the data.
I saw this question but it didn't help me.
The code below creates data.frame
with date and count
agr <-aggregate(input[1], input[2], FUN = function(df) count=length(df))
colnames(agr)[2] <- "count"
The below the weekly
data created:
weekly <- agr %>%
tq_transmute(select = count,
mutate_fun = apply.weekly,
FUN = sum)
Now I want to convert this weekly data to time series data so that I can apply ARIMA model.