[R-SIG-Finance] Problem in getSymbols.mysql()

Luis Torgo ltorgo at inescporto.pt
Sun Sep 27 23:35:26 CEST 2009


Dear All,

I've noted a small problem in function getSymbols.mysql().
My setup:
   Package    Version
"quantmod"   "0.3-11"

The problem has to do with the supposed flexibility in specifying the 
field names of the table on the MYSQL side. This flexibility is  to be 
given by the parameter "db.fields". However, the code in the function is 
then hardwired to a specific field name ("date"), in the following part:
...
query <- paste("SELECT ", paste(db.fields, collapse = ","),
            " FROM ", Symbols[[i]], " ORDER BY date")
...

This leads to errors when you do not have a table field named "date".

So, either the help page of the function is changed to mention that it 
is necessary to always have a "date" field and the "db.fields" parameter 
only refers to the "other" fields, or I think it is necessary to have a 
separate parameter for specifying which is the time tag field in the 
table and then do something like:
...
query <- paste("SELECT ", paste(c(time.field,db.fields), collapse = ","),
            " FROM ", Symbols[[i]], " ORDER BY ",time.field)
...

I think yet another possibility is to eliminate the ORDER BY clause, 
which maybe it is not that necessary, but this may be inadequate for 
some uses...

Thank you,
Luis Torgo

-- 
Luis Torgo
   FC/LIAAD - INESC Porto, LA    Phone : (+351) 22 339 20 93
   University of Porto           Fax   : (+351) 22 339 20 99
   R. de Ceuta, 118, 6o          email : ltorgo at liaad.up.pt
   4050-190 PORTO - PORTUGAL     WWW   : http://www.liaad.up.pt/~ltorgo



More information about the R-SIG-Finance mailing list