[R] multi-line query

Gabor Grothendieck ggrothendieck at gmail.com
Wed Nov 9 02:22:13 CET 2011


On Tue, Nov 8, 2011 at 1:04 PM, Ben quant <ccquant at gmail.com> wrote:
> Because I don't know anything about sqldf. :)
>
> Here is what happens, but I"m sure it is happening because I didn't read
> the manual yet:
>
>> s <- sqldf('create table r.dat("id" int primary key,"val" int)')
> Error in ls(envir = envir, all.names = private) :
>  invalid 'envir' argument
> Error in !dbPreExists : invalid argument type
>

Assuming you have loaded RpgSQL and sqldf it works for me so there is
likely some configuration in your setup, either with RpgSQL or with
PostgreSQL itself.

> s <- sqldf('create table dat("id" int primary key, "val" int)')
> sqldf("select * from dat")
[1] id  val
<0 rows> (or 0-length row.names)

If you are going to use your own create statements then you might be
better off using RpgSQL directly rather than sqldf.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list