Hi,

I want to use predictive modelling to predict the sales from September 2017 to February 2018. The numbers below are randomly chosen.

> library("scales", lib.loc="~/R/win-library/3.4")
> library(forecast)
> r = read.csv ("C:/Users/*** *****/Desktop/month_sales.csv", header=TRUE, sep=",", as.is=TRUE)
> r
Month Sales
1 1/01/2013 0
2 1/02/2013 0
3 1/03/2013 45.314
4 1/04/2013 187.026
5 1/05/2013 213.074
6 1/06/2013 291.916
7 1/07/2013 331.779
8 1/08/2013 240.079
9 1/09/2013 264.667
10 1/10/2013 291.111
11 1/11/2013 339.216
12 1/12/2013 315.390
13 1/01/2014 303.071
14 1/02/2014 260.007
15 1/03/2014 376.241
16 1/04/2014 273.525
17 1/05/2014 338.774
18 1/06/2014 369.424
19 1/07/2014 414.994
20 1/08/2014 360.822
21 1/09/2014 456.507
22 1/10/2014 505.922
23 1/11/2014 604.631
24 1/12/2014 636.381
25 1/01/2015 670.991
26 1/02/2015 752.491
27 1/03/2015 515.104
28 1/04/2015 684.859
29 1/05/2015 771.660
30 1/06/2015 1.026.290
31 1/07/2015 887.682
32 1/08/2015 915.093
33 1/09/2015 986.627
34 1/10/2015 1.169.360
35 1/11/2015 1.689.710
36 1/12/2015 1.425.135
37 1/01/2016 2.030.895
38 1/02/2016 1.811.825
39 1/03/2016 1.672.368
40 1/04/2016 1.775.078
41 1/05/2016 1.622.007
42 1/06/2016 1.809.413
43 1/07/2016 1.783.370
44 1/08/2016 1.856.511
45 1/09/2016 1.573.471
46 1/10/2016 1.970.403
47 1/11/2016 2.397.609
48 1/12/2016 2.205.069
49 1/01/2017 1.634.557
50 1/02/2017 1.562.091
51 1/03/2017 2.007.899
52 1/04/2017 1.779.463
53 1/05/2017 1.937.411
54 1/06/2017 2.093.391
55 1/07/2017 1.631.031
56 1/08/2017 1.713.524
> xi = ts(r$Sales, frequency = 12, start = c(2013, 1))
> xi
Jan Feb Mar Apr May Jun Jul Aug Sep Oct
2013 0 0 45.314 187.026 213.074 291.916 331.779 240.079 264.667 291.111
2014 303.071 260.007 376.241 273.525 338.774 369.424 414.994 360.822 456.507 505.922
2015 670.991 752.491 515.104 684.859 771.660 1.026.290 887.682 915.093 986.627 1.169.360
2016 2.030.895 1.811.825 1.672.368 1.775.078 1.622.007 1.809.413 1.783.370 1.856.511 1.573.471 1.970.403
2017 1.634.557 1.562.091 2.007.899 1.779.463 1.937.411 2.093.391 1.631.031 1.713.524
Nov Dec
2013 339.216 315.390
2014 604.631 636.381
2015 1.689.710 1.425.135
2016 2.397.609 2.205.069
2017
> plot.ts(xi)
Warning messages:
1: In xy.coords(x, NULL, log = log, setLab = FALSE) :
NAs introduced by coercion
2: In xy.coords(x, y) : NAs introduced by coercion


What is wrong with my code?

(furthermore I want to use:

pi = auto.arima(xi)
q = forecast(pi, h=20)
plot.forecast(q)