If you're trying to forecast this as a time series, you'll need to format it as such. Take a look at the tutorial here:
Note that it might be easier to work with if you tidy up the data to use the month and year values as a variable, so that you can format them as dates:
suppressPackageStartupMessages(library(tidyverse))
df = data.frame(
Jan10 = c(0, 18, 9, 4, 20, 18, 3, 34),
Feb10 = c(0, 19, 6, 0, 4, 14, 10, 10),
Mar10 = c(2, 7, 12, 11, 14, 0, 12, 10),
Oct15 = c(7, 16, 98, 42, 2, 18, 13, 3),
Nov15 = c(9, 9, 61, 0, 41, 14, 17, 11),
Dec15 = c(2, 72, 1, 11, 14, 2, 2, 19),
city = as.factor(c("SD", "BLR", "HAJ", "MEX", "SD", "BLR", "HAJ",
"MEX")),
type = as.factor(c("MER", "BMW", "MER", "BMW", "MER", "BMW", "MER",
"BMW")),
size = as.factor(c("13", "14", "15", "16", "17", "18", "19", "20"))
)
df %>%
gather(key = "mon_year", value = "measure", -city, -type, -size) %>%
mutate(mon_year = zoo::as.yearmon(mon_year, format = "%b%y")) %>%
select(one_of(c("mon_year", "city", "type", "size", "measure"))) # optional, I just like reordering the variables
#> mon_year city type size measure
#> 1 Jan 2010 SD MER 13 0
#> 2 Jan 2010 BLR BMW 14 18
#> 3 Jan 2010 HAJ MER 15 9
#> 4 Jan 2010 MEX BMW 16 4
#> 5 Jan 2010 SD MER 17 20
#> 6 Jan 2010 BLR BMW 18 18
#> 7 Jan 2010 HAJ MER 19 3
#> 8 Jan 2010 MEX BMW 20 34
#> 9 Feb 2010 SD MER 13 0
#> 10 Feb 2010 BLR BMW 14 19
#> 11 Feb 2010 HAJ MER 15 6
#> 12 Feb 2010 MEX BMW 16 0
#> 13 Feb 2010 SD MER 17 4
#> 14 Feb 2010 BLR BMW 18 14
#> 15 Feb 2010 HAJ MER 19 10
#> 16 Feb 2010 MEX BMW 20 10
#> 17 Mar 2010 SD MER 13 2
#> 18 Mar 2010 BLR BMW 14 7
#> 19 Mar 2010 HAJ MER 15 12
#> 20 Mar 2010 MEX BMW 16 11
#> 21 Mar 2010 SD MER 17 14
#> 22 Mar 2010 BLR BMW 18 0
#> 23 Mar 2010 HAJ MER 19 12
#> 24 Mar 2010 MEX BMW 20 10
#> 25 Oct 2015 SD MER 13 7
#> 26 Oct 2015 BLR BMW 14 16
#> 27 Oct 2015 HAJ MER 15 98
#> 28 Oct 2015 MEX BMW 16 42
#> 29 Oct 2015 SD MER 17 2
#> 30 Oct 2015 BLR BMW 18 18
#> 31 Oct 2015 HAJ MER 19 13
#> 32 Oct 2015 MEX BMW 20 3
#> 33 Nov 2015 SD MER 13 9
#> 34 Nov 2015 BLR BMW 14 9
#> 35 Nov 2015 HAJ MER 15 61
#> 36 Nov 2015 MEX BMW 16 0
#> 37 Nov 2015 SD MER 17 41
#> 38 Nov 2015 BLR BMW 18 14
#> 39 Nov 2015 HAJ MER 19 17
#> 40 Nov 2015 MEX BMW 20 11
#> 41 Dec 2015 SD MER 13 2
#> 42 Dec 2015 BLR BMW 14 72
#> 43 Dec 2015 HAJ MER 15 1
#> 44 Dec 2015 MEX BMW 16 11
#> 45 Dec 2015 SD MER 17 14
#> 46 Dec 2015 BLR BMW 18 2
#> 47 Dec 2015 HAJ MER 19 2
#> 48 Dec 2015 MEX BMW 20 19
Created on 2019-02-26 by the reprex package (v0.2.1)