I deleted my previous post since I believe it had unnecessary information and the direction of the question seemed to be straying away from what I wanted. I apologize to anyone that looked into it.
I was able to boil the question down to a simple function I am looking for:
How am I able to look at a time series data set and then look at the first date in the data and then insert a new date that is the closest beginning of a quarter of that dataset
For example, my data might be something like:
data={{{2015, 8, 10, 0, 0, 0.}, 21.1}, {{2015, 8, 21, 0, 0,
0.},20.7}, {{2015, 8, 24, 0, 0, 0.},18.8}, {{2015, 8, 25, 0, 0,
0.}, 22.0}, {{2016, 2, 3, 0, 0, 0.},13.8}, {{2016, 2, 4, 0, 0, 0.},
15.3}, {{2016, 2, 5, 0, 0, 0.},12.6}}
I want to be able to find the quarter it is in and start inserting data2 (see below) where it starts.
I want to join this data with another dataset that inserts "0" values into months that aren't present:
data2=Transpose[{#, Array[0 &, {Length@#}]}] &[
DateRange[{data[[1, 1, 1]]}, {data[[-1, 1, 1]]}, "Month"]]
From the example above, looking at data
, I want to be able to write data2
such that it will start at quarter 3 {{2015,7,1,0,0,0.},XX},{{2015, 8, 10, 0, 0, 0.}, 21.1}, {{2015, 8, 21, 0, 0,
0.},20.7}, ...}}
Thank you!