[R] The RSQLite version of dbGetQuery drops colums

Seth Falcon seth at userprimary.net
Tue Dec 29 22:36:29 CET 2009


Hi  Magnus,

Magnus Torfason <zulutime.net <at> gmail.com> writes:
> I just noticed (the hard way of course) that when a query returns 0 
> rows, the columns in the resulting data.frame get dropped as well. See 
> the following example code (where conn is an active connection to an 
> SQLite db):
> 
>  > dbGetQuery(conn, "select 1 as hey, 2 as ho where 1")
>    hey ho
> 1   1  2
>  > dbGetQuery(conn, "select 1 as hey, 2 as ho where 0")
> data frame with 0 columns and 0 rows
> 
> I believe that the second query should return a 0x2 data.frame instead, 
> that is, the same value as:

I agree that keeping the column dimension is sensible.  I will see
about fixing that for the next release.

> Any thoughts? Is this a bug, and are the developers of RSQLite
> reading this?

A much better forum for RSQLite issues is the r-sig-db list.

+ seth




More information about the R-help mailing list