I normally use filter
with grepl
in dplyr, but when using dbplyr
. I get an error that grepl is not a recognized function. My guess is that it can't translate to SQL server. What is a way around this with dbplyr
Here is a reproducible example
library(dbplyr)
library(nycflights13)
## Working chunk
con <-DBI::dbConnect(RSQLite::SQLite(), ":memory:")
DBI::dbWriteTable(con, "flights", flights)
DBI::dbGetQuery(con, "SELECT origin, flight
FROM flights WHERE origin like '%jf%'")
## End working chunk
## The below code does not work
flights <- tbl(con,"flights")
flights %>%
select(origin, flight) %>%
filter(grepl('jf', origin))
Im not quiet sure what your asking but have u tried any
at
functions?eg..