I have a data frame with stock returns r
and the risk free rate of return rf
. For the risk free rate of return I do not have observations for all the days for which I have observations for the stocks. Thus, I want to fill the missing values in the time series of the risk free returns by their previous day's observation in order to get rf_new
.
My data looks like
date r rf rf_new
2013-01-02 0.0211 0.0100 0.0100
2013-01-03 0.0101 0.0099 0.0099
2013-01-04 -0.010 NA 0.0099
2013-01-05 0.0031 0.0111 0.0111
2013-01-07 -0.003 NA 0.0111
2013-01-08 0.0050 NA 0.0111
...
How can I get rf_new?