本文介绍了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: GREPLthx 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表?
发布评论