[R-SIG-Finance] Enhancements to getSymbols.MySQL
Jeffrey Ryan
jeff.a.ryan at gmail.com
Tue May 15 06:54:46 CEST 2012
In R-forge version 578 now.
Thanks,
Jeff
On 5/14/12 1:48 PM, "Cedrick Johnson" <cedrickjohnson at me.com> wrote:
>Hello-
>
>Was upgrading my version of quantmod locally to the latest version on
>r-forge and noticed that there's a couple things that could be
>"improved" in the getSymbols.R file...
>
>starting at line 418:
>
>"getSymbols.MySQL" <- function(Symbols,env,return.class='xts',
> db.fields=c('date','o','h','l','c','v','a'),
> field.names = NULL,
> user=NULL,password=NULL,dbname=NULL,...) {
>
>is missing the ability to specify a remote host and port. Here's my fix
>(lines 418-422):
>
>"getSymbols.MySQL" <- function(Symbols,env,return.class='xts',
> db.fields=c('date','o','h','l','c','v','a'),
> field.names = NULL,
> user=NULL,password=NULL,dbname=NULL,
>host='localhost',port=3306,...) {
>
>further down on line 443:
>
>con <- dbConnect(MySQL(),user=user,password=password,dbname=dbname)
>
>should be:
>
>con <-
>dbConnect(MySQL(),user=user,password=password,dbname=dbname,host=host,
>port=port)
>
>This fix enables me to specify (using setDefaults) hosts and port, as
>shown below:
>
>setDefaults(getSymbols.MySQL, user="wee", password="wee", host="myhost",
>port=3306, dbname="histdata")
>
>As it stands now, the setDefaults block above will generate a warning
>message:
>port¹ was not set, possibly not a formal arg for getSymbols.MySQL¹
>host¹ was not set, possibly not a formal arg for getSymbols.MySQL¹
>
>
>Thanks,
>CJ
More information about the R-SIG-Finance
mailing list