dbSendQuery with R variables
On 5/11/10 5:01 AM, jim holtman wrote:
?paste On Mon, May 10, 2010 at 6:21 PM, Jonathan Greenberg <greenberg at ucdavis.edu>wrote:
Rhelpers:
I'd like to modify this RSQLite statement:
rs_stations<-dbSendQuery(con_stations, "select * from stations")
so that stations is actually an R variable, e.g.:
stations=c("stationA","stationB")
How would I modify the above statement to query from stations[[1]]
(aka "stationA")?
In the end, I think paste is your only option. The latest version of
RSQLite does support parameterized SELECT queries, but you cannot use
the parameters to specify table names, only values.
For details of what is supported, try reading through the examples in
help("dbSendPreparedQuery")
+ seth
Seth Falcon | @sfalcon | http://userprimary.net/