summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
-