Description Usage Format Details Source Examples
VFITX prices
1 |
A data frame with 3626 observations on the following 7 variables.
Date
date, as a factor
Open
a numeric vector
High
a numeric vector
Low
a numeric vector
Close
a numeric vector
Volume
a numeric vector
Adj.Close
a numeric vector
Price 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 | data(VFITX_prices)
pr.df <- VFITX_prices
pr.df$Date <- as.Date(pr.df$Date)
pr.df$month <- format(pr.df$Date,format="%m")
pr.df <- subset(pr.df,month=="06"|month=="12",select=c("Date","Close","month"))
pr.df$month <- as.numeric(pr.df$month)
pr.df$year <- as.numeric(format(pr.df$Date,format="%Y"))
pr.df$day <- as.numeric(format(pr.df$Date,format="%d"))
# Select last available day of each month
by.res <- by(pr.df,list(pr.df$month,pr.df$year),function(x) x[x$day==max(x$day),] )
pr.df <- by.res[[1]]
for(i in seq(2,length(by.res))) {
if(!is.null(by.res[[i]])) {
pr.df <- rbind(pr.df,by.res[[i]])
}
}
pr.df <- subset(pr.df,select=c("Close","month","year"))
names(pr.df)[names(pr.df)=="Close"] <- "p"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.