
I'm working with the following code:        

        atmpt <- try(table <- getSymbols(yahooSymbol))
        options(show.error.messages = TRUE)
        if(inherits(atmpt, "try-error"){
        } else {
            # insert data from table here
            for (i in 1:length(table)){    
                sql <- paste("Insert into ", myDBSymbol," (dayDate, dayOpen, dayHigh, dayLow, dayClose, dayVolume, dayAdjustment) values (",index(table[i]),",",  table[i,],",", table[i,2],",", table[i,3],",", table[i,4],",", table[i,5],",", symbolData[i,6],")")                    
                atmpt <- try(dbGetQuery( con, sql))
                options(show.error.messages = TRUE)
                if(inherits(dataEntry, "try-error")){
                    dataEntry <- NA
                } else {
                }
            }
        }

I imagine you can see a heap of errors in the code above but my first problem is that I'm not accessing the data returned from getSymbols properly and the insert statement fails on bad data. 

AAB.TO happens to be the value of  yahooSymbol, from the R prompt I get

> length(AAB.TO)
[1] 4452
> length(table)
[1] 1
> length(yahooSymbol)
[1] 1

Accessing AAB.TO is easy enough, but the code is part of a loop where the symbol in yahooSymbol changes each iteration, can anyone help me to access the values returned by getSymbol dynamically as by the insert statement above?

Regards, 

Nick
 		 	   		  
	[[alternative HTML version deleted]]

