I'm working on a R data.frame
which is made of stocks'dividends per year (I've got 60 stocks in columns and the usual calendar in rows). When a dividend is paid, I've got the figure and otherwise there is a NA
.
Basically , here is how my Data.frame looks like
BARC LN BARN SE BAS GY BATS LN
1999-01-01 0.26 NA NA
1999-01-02 NA 0.56 0.35 NA
1999-01-03 NA NA NA NA
2000-01-04 NA NA 0.40 NA
1999-01-05 0.23 0.28 NA NA
2001-01-06 NA NA NA NA
2001-01-07 0.85 NA 0.15 NA
I would like to get the amount of dividend paid per year for each stock in order to compute the dividend yield ratio and finally get a Data;frame like the one below :
BARC LN BARN SE BAS GY BATS LN
1999 NA NA NA NA
2000 NA NA NA NA
2001 NA NA NA NA
How can i do that?