[R] using variable in rmysql query

Mohan L l.mohanphysics at gmail.com
Sun Nov 7 10:51:37 CET 2010


Dear All,

I am using this query it returns id :

id <- dbGetQuery(con1,"SELECT id FROM tenants WHERE name LIKE '%consim%'")

But In my case the string "consim" is there in another variable(it is
coming from configuration file);

> str <- "consim"

I am trying to replace the string some this like, but it not working:

> id <- dbGetQuery(con1,"SELECT id FROM tenants WHERE name LIKE '%str%'")

I need help to replace the value of str . Any help will really appreciated .

Thanks for your time.

Mohan L



More information about the R-help mailing list