0

I have a data table which I want to convert to a time series ts(). I am able to convert a single column one at a time but I have to convert entire table and then forecast the future values. Here is the sample data

 WeekNum 930000405 930000408 930000640 930000651 930000652 930000653 4133101312
1        1         0         0         0         3         1        10          8
2        2         0         0         0         7         3         5          4
3        3         0         3         0         7         5         8          3
4        4         0         0         0         9         1        12          6
5        5         2         0         0         3         1        14          2
6        6         2         0         0         7         2         3          6
7        7         1         1         1         9         0         7          7
8        8         0         1         0         3         2        15          4
9        9         0         0         0         7         4         6          6

Supposing that I have to get the prediction for 10th week I want to convert it to ts() and then finally use forecast() on the time series. Please help on how to convert the entire table. When I am simply using ts(data) it is just converting it but not to a time series.

Abhishek Singh
  • 187
  • 2
  • 13
  • Do you have a `data.table` or `data.frame`? When you say that you want to convert the entire table to time series, do you want it by each column? It is not clear – akrun May 16 '17 at 05:56
  • Yes. Data table. I meant that the 10th row should have values from forecast(data,1) but for that I want to convert it to a time series – Abhishek Singh May 16 '17 at 06:08
  • What have you tried? Could you explain why did you convert a single column? What does each column represent? – llrs May 16 '17 at 07:22
  • Each column are for example different products and I want to predict the tenth week sales. I picked one product and converted it to a time series then it was happening. But to convert the data.table it was not. – Abhishek Singh May 16 '17 at 07:25

0 Answers0