[R-sig-DB] dbWriteTable in RPostgreSQL can't handle date and timestamp data types.

Xiaobo Gu gux|@obo1982 @end|ng |rom gm@||@com
Mon Mar 7 09:28:06 CET 2011


On Mon, Mar 7, 2011 at 2:07 PM, Tomoaki NISHIYAMA
<tomoakin using kenroku.kanazawa-u.ac.jp> wrote:
> Hi,
>
>> Can you implement Date and Timestamp first please?
>
>
> If you write a reasonable code with proper test cases, I can commit it.
> I personally do not have that motivation.
>
> Neither RMySQL nor ROracle, do have implemented that feature.
> Anyway, if the text is in a proper format, it is not very difficult
> to convert them to date or timestamp datatype within postgresql
> by issuing an appropriate SQL.
>
> By the way, I really do not understand
>>>>
>>>> data fram with columns of type date and timestamps
>

> df <- dbReadTable(con, "rtest")
> df
  a     b          c                   d
1 1 amber 2011-03-07 2011-03-07 16:30:39
2 2 linda 2011-03-07 2011-03-07 16:30:39
> class(df[["c"]])
[1] "Date"
> class(df[["d"]])
[1] "POSIXct" "POSIXt"

>
> data frame implies it is R data, but what class in fact?
>
> If you get that data from postgresql, it is already just a
> string and putting a string as a text is the right job for
> dbWriteTable().

> --
> Tomoaki NISHIYAMA
>
> Advanced Science Research Center,
> Kanazawa University,
> 13-1 Takara-machi,
> Kanazawa, 920-0934, Japan
>
>




More information about the R-sig-DB mailing list