Description Usage Format Details Source Examples
VFITX dividends
1 |
A data frame with 177 observations on the following 2 variables.
Date
Date, as a factor
Dividends
a numeric vector
Dividend history only. See demo file for details.
Yahoo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | data(VFITX_div)
div.df <- VFITX_div
div.df$Date <- as.Date(div.df$Date)
div.df$month <- as.numeric(format(div.df$Date,format="%m"))
div.df$year <- as.numeric(format(div.df$Date,format="%Y"))
# Aggregate into 6-month dividends
div.df$month[div.df$month>=1&div.df$month<=6] <- 6
div.df$month[div.df$month>=7&div.df$month<=12] <- 12
by.res <- by(div.df,list(div.df$month,div.df$year),
function(x) {
return(data.frame(div=sum(x$Dividends),N=length(x$Dividends)))
})
div.df <- by.res[[1]]
for(i in seq(2,length(by.res))) {
if(!is.null(by.res[[i]])) {
div.df <- rbind(div.df,by.res[[i]])
}
}
div.df$month <- as.numeric(rep(dimnames(by.res)[[1]],length(dimnames(by.res)[[2]])))
div.df$year <- as.numeric(rep(dimnames(by.res)[[2]],each=length(dimnames(by.res)[[1]])))
div.df <- subset(div.df,N>=6,select=c(-N)) # Exclude partial half-years
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.