Hi,
My Date column is of "Date" type and I want it that way. However, the Date variable shows January values for all years first, then Februray values for all the years, and so on. I would like to have it in the sequesnce of all months in the same year first, then all months in the next year. For example, 2015 -01-01, 2015-02-01, and so on all the way to 2015-12-01 and then similar details for 2016. Can you please help? I have shown a small data sample below. Thank you!
data.frame(
Date = c("2015-01-01","2016-01-01","2017-01-01","2018-01-01",
"2019-01-01","2020-01-01","2015-02-01",
"2016-02-01","2017-02-01","2018-02-01","2019-02-01",
"2020-02-01"),
Sales = c(768954,
814523,881179,944901,1071196,1093808,738399,
822000,766659,845464,994354,867130)
)
#> Date Sales
#> 1 2015-01-01 768954
#> 2 2016-01-01 814523
#> 3 2017-01-01 881179
#> 4 2018-01-01 944901
#> 5 2019-01-01 1071196
#> 6 2020-01-01 1093808
#> 7 2015-02-01 738399
#> 8 2016-02-01 822000
#> 9 2017-02-01 766659
#> 10 2018-02-01 845464
#> 11 2019-02-01 994354
#> 12 2020-02-01 867130
Created on 2020-07-31 by the reprex package (v0.3.0)