I have two data frames. One of them consists of three variables: “date”, “hit” and “volume” with 20 observations per day, 100 per month and 1200 per year (on trading days), which is as follows
Date Price Vol 2008-09-01 20 0.2 2008-09-01 30 0.5 ...
So, for each month, I have certain values for the price and volume, from 10 to 40, from 0.1 to 0.7, respectively.
The second is the interpolated values from the first. Therefore, I no longer have a date, but small steps for other variables:
Price Vol 20 0.2 21 0.21 22 0.24 30 0.5
So, although one frame shows values in discrete time, the other is more or less continuous. Now my question is: how can R be defined to combine the second data frame into the first, taking continuous price / volume dates between two discrete ones, to get something like this:
Date Price Vol 2008-09-01 20 0.2 2008-09-01 21 0.21 2008-09-01 22 0.24 ... 2008-09-01 30 0.5
I just can't figure out how to do this. I always got NA values for dates that are no longer in ascending order.
Thanks so much for your support.
Dani
source share