I have one big dataframe that needs to be populated within a loop, where, at each step, data for a different year are imported.
Let's say the big dataframe df1
is initialized like this:
date VAR
2006-01-01 NA
2006-01-02 NA
2006-01-03 NA
...
2007-01-01 NA
2007-01-02 NA
...
2008-01-01 NA
2008-01-02 NA
At each step of the loop (i.e., a different year) I have such data df2
:
date VAR
2006-01-01 NA
2006-01-02 NA
...
How could I "populate" df1
by values in df2
, using some basic R functions, e.g. merge
? I would also like to keep NA
where data from df2
are missing. Thanks!