
Hi,


As often on this mailing list, my apologies if the question is trivial. I still quite new to R

I am using R 2.8.0 with the cocoa GUI available for free download, so under mac os x (but irrelevant here I believe) 
I try to extract data from a MySQL DB using RMySQL package.

The connection functions fine and I can extract manually without any issue. My aim is to create a R function to "automate" the extraction from my DB

Here is the piece of code I am trying to work out.

upload_prices_single <- function(ticker, date_start,date_end)

{

Connect <- dbConnect(dbDriver("MySQL"),host="localhost",username="root",password="",dbname="QF_DUMP14122008",port="")
    
data <- dbGetQuery(Connect,paste("select quote_date, quote_adj_close from qf_data_yahoo where quote_name = 'ticker' and quote_date > 'date_start' and quote_date < 'date_end'"))

return(data)
}


If I type the "dbGetQuery" command entering the ticker manually in the console like below functions:

Connect <- dbConnect(dbDriver("MySQL"),host="localhost",username="root",password="",dbname="QF_DUMP14122008",port="")

data <- dbGetQuery(Connect,paste("select quote_date, quote_adj_close
from qf_data_yahoo where quote_name = 'III.L' and quote_date >
'2008-11-12' and quote_date < '2008-12-12'"))

So I guess it "only" an issue with assigning correctly "III.L" to a variable "ticker" and passing it on correctly...


Any help is appreciated


Thanks & regards,
Julien


_________________________________________________________________


	[[alternative HTML version deleted]]

