grepl的dplyr sql表?

编程入门 行业动态 更新时间:2024-10-24 14:15:39
本文介绍了grepl的dplyr sql表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以使用

filter(df, grepl("A|B|C",location))

对于dplyr SQL表?在SQL中,它可能像 Like 一样。当然,我可以将SQL表转换为R数据表,但是它非常大。 ( cran.r-project/web/packages/dplyr/vignettes /databases.html )此刻,我得到

for a dplyr SQL table? In SQL it is probalby a LIKE. Of cource I could convert the SQL table to a R data table, but it is very large. (cran.r-project/web/packages/dplyr/vignettes/databases.html) At the moment I get

Error in sqliteSendQuery(conn, statement) : error in statement: no such function: GREPL

thx Christof

thx Christof

推荐答案

使用 sql 直接将表达式转换为sql是一种选择。

Using sql to translate the expression directly into sql is one option.

sql_table %>% filter( sql("location LIKE 'A%' OR location LIKE 'B%' OR location LIKE 'C%'")

这会将以下内容注入您的WHERE语句中查询:

Which will inject the following into the WHERE statement of your query:

<SQL> location LIKE 'A%' OR location LIKE 'B%' OR location LIKE 'C%'

更多推荐

grepl的dplyr sql表?

本文发布于:2023-10-24 09:38:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523595.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:grepl   dplyr   sql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!