Boa noite,

Precisa tirar o argumento header=T que não é válido para write.table(). O equivalente seria col.names=T que já é default.

Éder Comunello <comunello.eder@gmail.com>
Dourados, MS - [22 16.5'S, 54 49'W]

Em 15 de março de 2015 19:43, Mauro Sznelwar <sznelwar@uol.com.br> escreveu:

Por que não estou conseguindo rodar?

 

symbol<-c("XOM","AAPL", "DIS")

 

 getCSV <- function(symbol){

+   URL <- paste0("http://chartapi.finance.yahoo.com/instrument/1.0/", symbol, "/chartdata;type=quote;range=1d/csv")

+   tab <- read.table(URL, sep = ",", dec = ".", skip = 17)

+   colnames(tab) <- paste(c("timestamp","close","high","low","open","volume"), 1:6, sep = "-")

+   rownames(tab) <- paste(symbol, 1:nrow(tab))

+   SAIDA <- paste0("Dados",symbol,"yahoo20150312.txt")

+   write.table(tab, file = SAIDA, sep = ";", dec = ".", header = T)

+ }

 

 sapply(symbol, getCSV)

Error in write.table(tab, file = SAIDA, sep = ";", dec = ".", header = T) :

  unused argument (header = T)