I've already converted Sales_Data to xts and now want to convert to ts-in a time series data as:
Sales_Data_xts<-xts(Sales_Data[, -1], order.by = as.POSIXct(Sales_Data$Month))
With the following argument below, I'm getting ending up with an error below:
frequency(Sales_Data_xts)
[1] Inf
Sales_Data_ts<-as.ts(Sales_Data_xts, start=start(Sales_Data_xts), end=end(Sales_Data_xts), frequency=frequency(Sales_Data_xts))
Error in ts(coredata(x), frequency = frequency(x), ...) : formal argument "frequency" matched by multiple actual argument
I also tried to calculate the frequency as I have 2310 rows and 6 days as: frequency=2310/6=385, and used it as:
Sales_Data_ts<-as.ts(Sales_Data_xts, start=start(Sales_Data_xts), end=end(Sales_Data_xts), frequency=385)
But still the same error:
Error in ts(coredata(x), frequency = frequency(x), ...) : formal argument "frequency" matched by multiple actual arguments
Please tell me how to convert xts
to ts
, so I can use the model for further time-series modelling. Thank you. Any solution for this will be appreciated.