RE: [R] R -SQL

2005-05-18 Thread Gesmann, Markus
Your code looks more like Visual Basic rather than R.
What you want is:

for(j in 1:length(criteria$Title)){

sqlstring - paste(select q.type,crit.Title, r.Value from criteria crit, reply 
r,question_reply qr, question q, question_criteria qc, form_question fq where 
qr.reply=r.ID and qr.question=q.ID and qc.question=q.ID and crit.ID=qc.criteria 
and fq.question=q.ID and fq.form=4 and crit.Title=', criteria$Title[j], ';, 
sep=)

graphe_par-sqlQuery(channel,sqlstring)

}

See ?paste

Regards

Markus

Your SQL statement seems to be wrong. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Navarre Sabine
Sent: 18 May 2005 13:03
To: r-help@stat.math.ethz.ch
Subject: [R] R -SQL


Hello,
 
I've got a problem in a sql query!


for(j in 1:length(criteria$Title))

{
graphe_par-sqlQuery(channel,select q.type,crit.Title, r.Value from 
criteria crit, reply r,question_reply qr, question q, question_criteria qc, 
form_question fq where qr.reply=r.ID and qr.question=q.ID and qc.question=q.ID 
and crit.ID=qc.criteria and fq.question=q.ID and fq.form=4 and crit.Title=  
criteria$Title[j] ;)

}


 criteria$Title
[1] Content   Logistic  Trainer   Supply
User contribution
Levels: Content Logistic Supply Trainer User contribution


The error is:
Error in select q.type,crit.Title, r.Value from criteria crit, reply 
r,question_reply qr, question q, question_criteria qc, form_question fq where 
qr.reply=r.ID and qr.question=q.ID and qc.question=q.ID and crit.ID=qc.criteria 
and fq.question=q.ID and fq.form=4 and crit.Title=   : 
operations are possible only for numeric or logical types
In addition: Warning message:
 not meaningful for factors in: Ops.factor(select q.type,crit.Title, r.Value 
from criteria crit, reply r,question_reply qr, question q, question_criteria 
qc, form_question fq where qr.reply=r.ID and qr.question=q.ID and 
qc.question=q.ID and crit.ID=qc.criteria and fq.question=q.ID and fq.form=4 and 
crit.Title=, 

please help me,

Thanks a lot!

Sabine



-

ils, photos et vidéos !

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html





LNSCNTMCS01***
The information in this E-Mail and in any attachments is CON...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R -SQL

2005-05-18 Thread Prof Brian Ripley
You have not told us what package you are using (and I think this is a 
repeat of a post also missing that crucial information).

However, the main problem appears to be that you think  operates on 
character strings.  You have not told us your intentions, which might have 
been

paste(select ... crit.Title=, criteria$Title[j], ;, sep=)

On Wed, 18 May 2005, Navarre Sabine wrote:
Hello,
I've got a problem in a sql query!
for(j in 1:length(criteria$Title))
{
   graphe_par-sqlQuery(channel,select q.type,crit.Title, r.Value from 
criteria crit, reply r,question_reply qr, question q, question_criteria 
qc, form_question fq where qr.reply=r.ID and qr.question=q.ID and 
qc.question=q.ID and crit.ID=qc.criteria and fq.question=q.ID and 
fq.form=4 and crit.Title=  criteria$Title[j] ;)

}

criteria$Title
[1] Content   Logistic  Trainer   Supply
User contribution
Levels: Content Logistic Supply Trainer User contribution
The error is:
Error in select q.type,crit.Title, r.Value from criteria crit, reply r,question_reply 
qr, question q, question_criteria qc, form_question fq where qr.reply=r.ID and 
qr.question=q.ID and qc.question=q.ID and crit.ID=qc.criteria and fq.question=q.ID and 
fq.form=4 and crit.Title=   :
   operations are possible only for numeric or logical types
In addition: Warning message:
 not meaningful for factors in: Ops.factor(select q.type,crit.Title, r.Value from 
criteria crit, reply r,question_reply qr, question q, question_criteria qc, form_question fq 
where qr.reply=r.ID and qr.question=q.ID and qc.question=q.ID and crit.ID=qc.criteria and 
fq.question=q.ID and fq.form=4 and crit.Title=,

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html