R SQLDF中的语法错误," rsqlite_send_query中的错误"

时间:2017-05-19 17:41:29

标签: sql r

我有一个名为" model_probabilities"的数据框。在R.我需要专门使用SQL查询。所以我使用sqldf模块。所提到的所有三列都具有0到1之间的值。我试图在R中执行以下查询。

col1=sqldf("select
CASE 
        when ( select max(v) from ( values(local_schools__good) , (local_schools__fair) , (local_schools__poor)) as value (v)) in (local_schools__good) then 'local_schools__good'
        when (select max(v) from ( values(local_schools__good) , (local_schools__fair) , (local_schools__poor)) as value (v)) in (local_schools__fair) then 'local_schools__fair'
        when ( select max(v) from ( values(local_schools__good) ,  (local_schools__fair) , (local_schools__poor)) as value (v)) in (local_schools__poor) then 'local_schools__poor'
        else 'None'
        end 
           from model_probabilities")

我收到以下错误:

  

rsqlite_send_query中的错误(conn @ptr,statement):near"(&#34 ;: syntax error

0 个答案:

没有答案