I'm using r on Mac OSX and following this guide to download and maintain a collection of CSVs with stock prices.
http://www.thertrader.com/2015/12/13/maintaining-a-database-of-price-files-in-r/
library(quantmod)
startDate = "2000-01-01"
thePath = ""
source(paste("listOfInstruments.R",sep=""))
for (ii in theInstruments){
print(ii)
data = getSymbols(Symbols = ii,
src = "yahoo",
from = startDate,
auto.assign = FALSE)
colnames(data) = c("open","high","low","close","volume","adj.")
write.zoo(data,paste(thePath,ii,".csv",sep=""),sep=",",row.names=FALSE)
}
I'm trying to keep my R files separately from my CSV files, so I change the variable "thePath" to an existing subdirectory named csv. e.g. thePath = "\csv\"
However this creates a file which is actually named csv^GSPC.csv as opposed to writing into a subfolder.
What is the correct way to specify the write.zoo path?
