On Tue, Dec 13, 2011 at 10:54 AM, agent dunham <crosspide at hotmail.com>
wrote:> Before loading sql packages, i was wondering, once all packages required
are
> installed, if ?it's possible to do from R console sth like this:
>
> SQL> select v1 from sql_table
> ? ? ? ?where v2 in ("R_variable") ?# being "R_variable"
a vector
>
Try this:
# test data
R_variable <- data.frame(x = 1:10)
sql_table <- data.frame(v1 = 1:10, v2 = rep(0:1, each = 5))
library(sqldf)
sqldf("select v1 from sql_table where v2 in (select x from
R_variable)")
The result of the last line is:
v1
1 6
2 7
3 8
4 9
5 10
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com