Skip to content
Back to formatted view

Raw Message

Message-ID: <971536df0705170757lb439704y248b8c478ed0774e@mail.gmail.com>
Date: 2007-05-17T14:57:40Z
From: Gabor Grothendieck
Subject: RSQLite and Date

Below dbDataType reports that "Date" class is represented as TEXT in the
data base.  When I write and read back a data frame it does come back
as "character" but as the character representation of the number of days
since the Epoch.  Is that how its supposed to work?

Are there any facilities that the user can control to specify how
given classes are converted back and forth?

> m <- dbDriver("SQLite")
> dbDataType(m, Sys.Date())
[1] "TEXT"
> con <- dbConnect(m, dbname=":memory:")
> DF <- data.frame(Date = Sys.Date() + 0:3, Value = 10:13)
> dbWriteTable(con, "DF", DF)
[1] TRUE
> str(dbReadTable(con, "DF"))
'data.frame':   4 obs. of  2 variables:
 $ Date__1 : chr  "13650.0" "13651.0" "13652.0" "13653.0"
 $ Value__1: int  10 11 12 13