I have a table with a yearly aggregate value. I want to split them up into the monthly values by dividing "Total" number by 12.
library(readr)
myData = read_delim("Date,b,c,d,Total\n2018,NA,NA,NA,12\n2018,0.5,0.5,NA,24\n2018,0.3,NA,0.5,36\n", delim=",")
myData
# A tibble: 3 x 5
Date b c d Total
<int> <dbl> <dbl> <dbl> <int>
1 2018 NA NA NA 12
2 2018 0.5 0.5 NA 24
3 2018 0.3 NA 0.5 36
desired output (for the first row, I'm expecting 36 rows in total):
Date b c d Total
1 2018-01-01 NA NA NA 1
2 2018-02-01 NA NA NA 1
3 2018-03-01 NA NA NA 1
4 2018-04-01 NA NA NA 1
5 2018-05-01 NA NA NA 1
6 2018-06-01 NA NA NA 1
7 2018-07-01 NA NA NA 1
8 2018-08-01 NA NA NA 1
9 2018-09-01 NA NA NA 1
10 2018-10-01 NA NA NA 1
11 2018-11-01 NA NA NA 1
12 2018-12-01 NA NA NA 1
I already checked the accepted answer here: Break summed row into individual rows in R but unfortunatley this is not working for me.