Skip to content
Back to formatted view

Raw Message

Message-ID: <0be101caf179$0d626710$28273530$@gmail.com>
Date: 2010-05-12T02:15:51Z
From: kMan
Subject: dbSendQuery with R variables
In-Reply-To: <AANLkTinJihwmSNUnw57HMI-ziIFGcifIoY-ilBOMhuiH@mail.gmail.com>

?paste

See also,
http://rwiki.sciviews.org/doku.php?id=large_scale_data:lsdioi_sqchunk for
additional examples.

Assuming stations[1:2] are tables your database:
simpleQuery<- paste("SELECT * FROM", stations[1]) # should read the whole
table when invoked
dbGetQuery(con_stations, simpleQuery)

Is this sort of what you had in mind?

Sincerely,
KeithC.


-----Original Message-----
From: Jonathan Greenberg [mailto:greenberg at ucdavis.edu] 
Sent: Monday, May 10, 2010 4:21 PM
To: r-help
Subject: [R] dbSendQuery with R variables

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")?

--j