[BioC] RMySQL, for loop problem...

Cui, Wenwu (NIH/NLM/NCBI) [C] cuiw at ncbi.nlm.nih.gov
Fri Jun 15 17:09:49 CEST 2007


Try to do assemble your sql command fist:

Sqlcmd <- paste("update GO_DC5_vs_50PC3_apoptosis set FC_low = ",
geni_FClow$FC_low[I], " where geni like ", geni_FClow$geni[i], sep =
"");

dbGetQuery(con, Sqlcmd);

Good luck!

Wenwu Cui

-----Original Message-----
From: Alessandro Bruselles [mailto:a.bruselles at gmail.com] 
Sent: Friday, June 15, 2007 9:56 AM
To: Bioconductor Mailing list
Subject: [BioC] RMySQL, for loop problem...

I'm trying to do a little loop using the RMySQL package to update some 
fields in my db
but I can't find a way;
the loop should be this:

/for (i in 1:nrow(geni_FClow)){
   dbGetQuery(con, "update GO_DC5_vs_50PC3_apoptosis set FC_low = 
geni_FClow$FC_low[i] where geni like geni_FClow$geni[i]")
}/

but I get the following error:

/Errore in mysqlExecStatement(conn, statement, ...) :
        RS-DBI driver: (could not run statement: You have an error in 
your SQL syntax; check the manual that corresponds to your MySQL server 
version for the right syntax to use near '[i] where geni like 
geni_FClow$geni[i]' at line 1)/

while the simple statement:

/dbGetQuery(con, "update GO_DC5_vs_50PC3_apoptosis set FC_low = 
geni_FClow$FC_low[2] where geni like geni_FClow$geni[2]")/

(using a number instead of the [i])
works!

Any help would be appreciated
(I know maybe the answer is so simple I cannot see it...)

-- 
_________________________________________

Alessandro Bruselles
University of Rome "Tor Vergata"** <mailto:a.bruselles at gmail.com>

_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives:
http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list