有没有解决方法可以使用类似于这样的东西?
filter(df, grepl("A|B|C",location))
如何在dplyr SQL表中进行模糊查询?在SQL中,这可能是一个LIKE
操作。当然,我可以将SQL表转换为R数据表,但它非常大。(http://cran.r-project.org/web/packages/dplyr/vignettes/databases.html)目前我得到的结果是:
Error in sqliteSendQuery(conn, statement) :
error in statement: no such function: GREPL
thx Christof
filter(df, location %in% c("a", "b", "c")
。或者使用semi_join()
函数。 - hadley%in%
和semi_join()
只进行精确匹配。 - cklussx %like% y
。 - hadleyx %like% "y"
会匹配整个变量,而x %like% "%y%"
会在列x中进行y的模式匹配。 - Veera