summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2011-10-09 21:31:30 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2011-10-09 21:31:30 -0400
commite218b9cb3b5290028d5121ecdf0622fe3f78bad8 (patch)
treef93bc8cbf4049e3f113dc6b1da053ee62622e041
parent146e3e1b1276c71d2467202b9aa85fbdc127d6eb (diff)
downloadbandit-e218b9cb3b5290028d5121ecdf0622fe3f78bad8.tar.gz
Small bug fix
-rw-r--r--bandit.R6
1 files changed, 2 insertions, 4 deletions
diff --git a/bandit.R b/bandit.R
index 1acb59a..a1b9703 100644
--- a/bandit.R
+++ b/bandit.R
@@ -51,8 +51,7 @@ for(day in 1:length(returns[,1])){
indexchange <- read.table("IndexChange_500.csv",sep="\t",header=T,quote="",
colClasses="character")
#cleanup tickers
-attach(indexchange)
-indexchange$Ticker.add <<- sub('/', '-',indexchange$Ticker.add)
+indexchange$Ticker.add <- sub('/', '-',indexchange$Ticker.add)
indexchange$Ticker.add <- sub('.wi', '',indexchange$Ticker.add,fixed=T)
indexchange$Ticker.add <- sub('wi', '',indexchange$Ticker.add)
indexchange$Ticker.add <- sub('.', '-',indexchange$Ticker.add,fixed=T)
@@ -71,6 +70,7 @@ for( i in 1:100){
sp500.historic[-match(indexchange$Ticker.add[i],sp500.historic$ticker),]
}else{
cat(paste("ticker",indexchange$Ticker.add[i],"not found\n"))
+ next()
}
}
#add ticker that was removed
@@ -80,5 +80,3 @@ for( i in 1:100){
indexchange$Ticker.del[i]))
}
}
-detach(indexchange)
-