if i have this data
C=
year month day hour minute rain
2010 01 01 00 00 0.000
2011 01 01 00 00 0.000
2012 01 01 00 00 0.000
2013 01 01 00 00 0.000
2014 01 01 00 00 0.000
2015 01 01 00 15 0.000
and reference data like:
R=
year month day hour minute rain
2013 01 01 00 00 0.000
2013 01 01 00 05 0.000
2013 01 01 00 10 0.000
2013 01 01 00 15 0.000
2013 01 01 00 20 0.000
2014 01 01 00 00 0.000
2014 01 01 00 05 0.000
2014 01 01 00 10 0.000
2014 01 01 00 15 0.000
2014 01 01 00 20 0.000
2015 01 01 00 00 0.000
2015 01 01 00 05 0.000
2015 01 01 00 10 0.000
2015 01 01 00 15 0.000
2015 01 01 00 20 0.000
I need to complete this M
M=
year month day hour minute rain
2013 01 01 00 00 0.000
2013 01 01 00 05 0.000
2013 01 01 00 10 0.000
2013 01 01 00 15 0.000
2013 01 01 00 20 0.000
2014 01 01 00 00 0.000
2014 01 01 00 05 0.000
2014 01 01 00 10 0.000
2014 01 01 00 15 0.000
2014 01 01 00 20 0.000
2015 01 01 00 15 0.000
2015 01 01 00 20 0.000
as you see, 2015 in M starts at "2015 01 01 00 15 0.000" and we could use C info to make a nrow(c) loop and look for starting dates, the idea is complete this dataframe using a loop and match to fill year, month, day, hour and minute from reference data R, and fill empty rain column with "NaN". the final output would be:
F=
year month day hour minute rain
2013 01 01 00 00 0.000
2013 01 01 00 05 0.000
2013 01 01 00 10 0.000
2013 01 01 00 15 0.000
2013 01 01 00 20 0.000
2014 01 01 00 00 0.000
2014 01 01 00 05 0.000
2014 01 01 00 10 0.000
2014 01 01 00 15 0.000
2014 01 01 00 20 0.000
2015 01 01 00 00 NaN
2015 01 01 00 05 NaN
2015 01 01 00 10 NaN
2015 01 01 00 15 0.000
2015 01 01 00 20 0.000