[R] Insert variable in RMySQL-Statement

PtitBleu ptit_bleu at yahoo.fr
Wed Feb 9 13:32:09 CET 2011


Maybe this solution will help you.
Ptit Bleu.

library(DBI)
library(RMySQL)
drv<-dbDriver("MySQL")
con<-dbConnect(drv, username=my_name, password=my_pwd, dbname=my_db,
host="localhost")

for (a in values) { 
    requete<-paste("select * from db where id=",a,sep="")
    rs<-dbSendQuery(con, requete)
    Temp<-fetch(rs, n=-1)
}

dbDisconnect(con)

-- 
View this message in context: http://r.789695.n4.nabble.com/Insert-variable-in-RMySQL-Statement-tp3296870p3297147.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list