I know this has been asked many times before, but for the life of me I
cannot find the answer in my notes. How do I get the column for
split-adjusted data from yahoo finance? The script I use to download the
data is:

require(quantmod)
library(plan)
source("/home/rvince/R/Work/ES50data.R");
for (i in 1:length(brsym)) {
tryCatch({
j <- paste("http://ichart.finance.yahoo.com/table.csv?s=",brsym[[i]],sep="");

j <- paste(j,"&g=d&ignore=.csv",sep="");
print(j);
X <- read.csv(j, header=TRUE);
#X$Date <- format(as.Date(X$Date),"%Y%m%d");
# Convert the "Date" column from a factor class to a Date class
X$Date <- as.Date(X$Date)
# Sort the X object by the Date column -- order(-X$Date) will sort it in
the other direction
X <- X[order(X$Date),]
# Format the date column as you want
X$Date <- format(as.Date(X$Date),"%Y%m%d");
X <- X[,1:6]
kk <- trim.whitespace(brsym[[i]]);
k <- paste("/home/rvince/AsciiCsv/ES50/", kk, sep="");
k <- trim.whitespace(k);
k <- paste(k,".csv", sep="");
write.table(X, k, append = FALSE, quote = FALSE, sep = ",",
            eol = "\n", na = "NA", dec = ".", row.names = FALSE,
            col.names = FALSE, qmethod = c("escape", "double"));
print(k);
ko <- paste(X$Date[1], "-",X$Date[length(X$Date)]);
print(ko);
}, interrupt = function(ex) {
cat("An interrupt was detected.\n");
print(ex);
}, error = function(ex) {
cat("An error was detected.\n");
print(ex);
}, finally = {
cat("done\n");
}) # tryCatch()
}

	[[alternative HTML version deleted]]

