在R 3.3.3中运行SQLDF查询时,为什么会遇到错误?

发布于 2025-02-08 07:30:14 字数 690 浏览 1 评论 0原文

我正在运行sqldf使用with子句在r 3.6.3中正常运行的子句,但在r 3.3.3中不正常。

使用R 3.6.3的结果:

sqldf("WITH cte_a AS (SELECT cyl, avg(mpg) FROM mtcars group by cyl) SELECT * from cte_a")
#  cyl avg(mpg)
#1   4 26.66364
#2   6 19.74286
#3   8 15.10000  

使用R 3.3.3的结果:

sqldf("WITH cte_a AS (SELECT cyl, avg(mpg) FROM mtcars group by cyl) SELECT * from cte_a")
#-----
Loading required package: tcltk
Error in rsqlite_send_query(conn@ptr, statement) : 
  near "WITH": syntax error
In addition: Warning message:
Quoted identifiers should have class SQL, use DBI::SQL() if the caller performs the quoting. 

任何帮助获得R 3.3.3查询工作的任何帮助将不胜感激。

I am running sqldf using a WITH clause that works fine in R 3.6.3 but not in R 3.3.3.

Results using R 3.6.3:

sqldf("WITH cte_a AS (SELECT cyl, avg(mpg) FROM mtcars group by cyl) SELECT * from cte_a")
#  cyl avg(mpg)
#1   4 26.66364
#2   6 19.74286
#3   8 15.10000  

Results using R 3.3.3:

sqldf("WITH cte_a AS (SELECT cyl, avg(mpg) FROM mtcars group by cyl) SELECT * from cte_a")
#-----
Loading required package: tcltk
Error in rsqlite_send_query(conn@ptr, statement) : 
  near "WITH": syntax error
In addition: Warning message:
Quoted identifiers should have class SQL, use DBI::SQL() if the caller performs the quoting. 

Any help getting the R 3.3.3 query to work would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文