Hi,
The following simple command:
algo <- "wait see"
expr <-paste(algo, "%")
line <-toString(cat(paste0('select * from tri where unigram like "', expr, '"')))
generates:
select * from tri where unigram like "wait see %"
but as a NULL character
Requests with SQL are not possible therefore. I am looking to get the parameter line as a character string which could go into a sqldf command
algo <- "wait see"
expr <-paste(algo, "%")
# remove errant " from here============================>X
line <-glue::glue('select * from tri where unigram like ', expr, '"')
line
#> select * from tri where unigram like wait see %"
algo <- "wait see"
expr <-paste(algo, "%")
tri <- data.frame( n= c(15,25), unigram =c("wait see city", "wait and see"))
sen <- glue :: glue('select * from tri where unigram like "', expr, '"')
sqldf(sen)
-> n unigram
1 15 wait see city
-> sen
select * from tri where unigram like "wait see %"
Glad that helped. (Why, o why, is punctuation so darned invisible?) The sen query looks well-formed. What about sql[1,2] is troubling?
algo <- "wait see"
expr <-paste(algo, "%")
sen <- glue::glue('select * from tri where unigram like "', expr, '"')
sen
#> select * from tri where unigram like "wait see %"