VFITX_div: Vanguard Intermediate Treasury Data, as downloaded from Yahoo

Description Usage Format Details Source Examples

Description

VFITX dividends

Usage

1

Format

A data frame with 177 observations on the following 2 variables.

Date

Date, as a factor

Dividends

a numeric vector

Details

Dividend history only. See demo file for details.

Source

Yahoo

Examples

 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

Example output

maRketSim - This software is research software and is not intended for real-time use.  Under no circumstances should it be used as the basis for market or trading decisions.

maRketSim documentation built on May 29, 2017, 10:54 p.m.