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

Xiaobo Gu gux|@obo1982 @end|ng |rom gm@||@com
Tue Mar 8 13:32:06 CET 2011


2011/3/8 Peng Lian <januslian using 126.com>:
> At 2011-03-07 20:32:42,"Xiaobo Gu" <guxiaobo1982 using gmail.com> wrote:
>>Can we specify data types for columns of the table created by
>>dbWriteTable, most times we want timestamp without timezone.
>>Another case is numeric numbers, in current implement all numeric data
>
> I think you can specify data types. Checking out the source file of
> RPostgreSQL
> package, the function of dbWriteTable use argument *filed.types* to specify
> data types, so through modifying default value of *filed.types*, which is
> represent by data type in PostgreSQL, may specify data types.

Since I can't find any documentation about this, can you show me some
sample code about specifying data types.

 Another feature we want is that we only want to specify the data type
for columns that we think the automatically mapping  implemented by
RPostgreSQL is not suitable to us.
For example, supporse we have a data frame with about 100 columns,
only a few of which are numeric numbers,such as col1/col2/col3, we
want the column types to be decimal(18,2), but not float8, users only
need to pass col1/col2/col3 to the function, and let RPostgreSQL
choose the data types for the rest of the columns.

>>are converted as float, but for some applications want it to be
>> >decimal with scales, > >Xiaobo Gu > >
>> >On Mon, Mar 7, 2011 at 6:37 PM, Tomoaki NISHIYAMA
>> ><tomoakin using kenroku.kanazawa-u.ac.jp> wrote: >> Hi, >> >>>> class(df[["c"]])
>> >>> >>> [1] "Date" >>>> >>>> class(df[["d"]]) >>> >>> [1] "POSIXct" "POSIXt"
>> >> >> >> Ok, if you know the class name, the change is simple as r179.
>> >> (r178, r180 are cleanups of other part) >> -- >> Tomoaki NISHIYAMA >>
>> >> Advanced Science Research Center, >> Kanazawa University,
>> >> 13-1 Takara-machi, >> Kanazawa, 920-0934, Japan >> >> >
>> >_______________________________________________
>> >R-sig-DB mailing list -- R Special Interest Group >R-sig-DB using r-project.org
>> >https://stat.ethz.ch/mailman/listinfo/r-sig-db
>
>




More information about the R-sig-DB mailing list