Le programme suivant me retourne un message d'erreur (voir plus bas). Je suis sous Ubuntu 14.04 et tous les dossiers sont dans le répertoire ~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| #!/usr/bin/Rscript
# data.r, downloads raw stock data
stocks = "stocks.txt"
args <- commandArgs(TRUE)
extract <- function(args){
stocks <- t(read.table(args[1],sep=",")[1,])
J <- length(stocks)
dir.create("data", showWarnings = FALSE)
path <- "http://real-chart.finance.yahoo.com/table.csv?s="
for(j in 1:J){
dat <- read.csv(paste(path,stocks[j],sep=""))
write.csv(dat, file=paste("./data/",stocks[j],sep=""),
row.names=FALSE, quote=FALSE)
}
}
extract(args) |
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") : cannot open file 'NA': No such file or directory
Peut-on m'indiquer mon erreur?
Merci
Jacques
Partager