[BioC] RMySQL, for loop problem...
Cui, Wenwu (NIH/NLM/NCBI) [C]
cuiw at ncbi.nlm.nih.gov
Mon Jun 18 15:33:36 CEST 2007
Try to printout your command before execute the query:
for (i in 1:nrow(geni_FClow)){
Sqlcmd <- paste("update GO_DC5_vs_50PC3_apoptosis set FC_low = ",
geni_FClow$FC_low[i], " where geni like ", geni_FClow$geni[i], sep =
"");
Sqlcmd;
#dbSendQuery(con, Sqlcmd)
}
You might need to add the \" before and after geni_FClow$geni[i].
Wenwu Cui, PhD
National Center for Biotechnology Information
National Institutes of Health
-----Original Message-----
From: Alessandro Bruselles [mailto:a.bruselles at gmail.com]
Sent: Monday, June 18, 2007 9:20 AM
Cc: Bioconductor at stat.math.ethz.ch
Subject: Re: [BioC] RMySQL, for loop problem...
This is the object I want to read from:
> geni_FClow
geni FC_low
1 AF039390 -1.704
2 AF039390 -1.704
3 AF116456 1.501
4 AJ250915 1.656
5 AJ250915 1.656
6 AF326592 1.835
This is the command I'm trying to use (as Cui, Wenwu suggested)
> Sqlcmd <- paste("update GO_DC5_vs_50PC3_apoptosis set FC_low = ",
geni_FClow$FC_low[i], " where geni like ", geni_FClow$geni[i], sep = "")
> for (i in 1:nrow(geni_FClow)){
+ dbSendQuery(con, Sqlcmd)
+ }
and this is the error I get:
Errore in mysqlExecStatement(conn, statement, ...) :
RS-DBI driver: (could not run statement: Unknown column
'AF039390' in 'where clause')
> is.data.frame(geni_FClow)
[1] TRUE
Thanks
Alessandro
Sean Davis ha scritto:
> Alessandro Bruselles wrote:
>
>> Thanks to all who tried to help me,
>> but none of the suggested solutions worked for me,
>> I still didn't manage to do the loop...
>> How else can I do to iteratively update my db?
>>
>
> Alessandro,
>
> You will probably want to post the code that you tried and what errors
> you received. The way you are trying is the correct way of performing
> the update, but there are a few details to get right before it will
work.
>
> Sean
>
>
[[alternative HTML version deleted]]
_______________________________________________
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