I have the following mySQL query:
"select * from data WHERE TEXT RLIKE '[[:<:]]digital[[:>:]]' OR TEXT RLIKE '[[:<:]]data[[:>:]]' OR TEXT RLIKE '[[:<:]]agile[[:>:]]' OR (TEXT RLIKE '[[:<:]]self[[:>:]]' AND TEXT RLIKE '[[:<:]]service[[:>:]]') OR TEXT RLIKE '[[:<:]]cloud[[:>:]]' OR TEXT RLIKE '[[:<:]]insight[^[:space:]]+[[:>:]]' OR TEXT RLIKE '[[:<:]]modern[^[:space:]]+[[:>:]]'")
I want to apply this in R using the sqldf package:
sqldf( "select * from data WHERE TEXT RLIKE '[[:<:]]digital[[:>:]]' OR TEXT RLIKE '[[:<:]]data[[:>:]]' OR TEXT RLIKE '[[:<:]]agile[[:>:]]' OR (TEXT RLIKE '[[:<:]]self[[:>:]]' AND TEXT RLIKE '[[:<:]]service[[:>:]]') OR TEXT RLIKE '[[:<:]]cloud[[:>:]]' OR TEXT RLIKE '[[:<:]]insight[^[:space:]]+[[:>:]]' OR TEXT RLIKE '[[:<:]]modern[^[:space:]]+[[:>:]]'")
that I want to run against some sample data:
data <- structure(list(Participant = 1:3, A = c("and other agile digital, things", "testing test and modern", "nothing here"), B = c("", "b", "b"), C = c("c", "c", "c")), .Names = c("Participant", "TEXT", "other", "another"), row.names = c(NA, -3L), class = "data.frame")
I get the following error
Error in sqliteSendQuery(con, statement, bind.data) : error in statement: near "RLIKE": syntax error
It seems like this package doesn't like RLIKE statements. Why, and how do I get around this?