I have a dataframe called Demandts
and it is presented as a tsibble below:
(with mam representing monthly MA)
# A tsibble: 255 x 7 [1]
# Key: Date [255]
Week Demand Date mam Quarter Month year
<dbl> <dbl> <date> <dbl> <qtr> <dbl> <chr>
1 1 48 2018-01-01 199. 2018 Q1 1 2018
2 2 101 2018-01-08 199. 2018 Q1 1 2018
3 3 129 2018-01-15 106. 2018 Q1 1 2018
4 4 113 2018-01-22 118. 2018 Q1 1 2018
5 5 116 2018-01-29 121. 2018 Q1 1 2018
6 6 123 2018-02-05 125. 2018 Q1 2 2018
7 7 137 2018-02-12 132. 2018 Q1 2 2018
8 8 136 2018-02-19 132. 2018 Q1 2 2018
9 9 151 2018-02-26 126. 2018 Q1 2 2018
10 10 87 2018-03-05 142. 2018 Q1 3 2018
# ... with 245 more row
I am trying to create a new column with the monthly average demand so that I can create a monthly plot with ggplot
.
edit* How do I average monthly demand?