Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating table in PostgreSQL from R platform by using RPostgreSQL

Tags:

r

postgresql

I am using RPostgreSQL package to connect the db to R. I wanted to update the db with those tables do not exist in db. Is it possible to create the new table from R in postgresql and update it with upcoming values? Any suggestion?

Sample of data:


       Date&Time               temp
1 2007-09-30 00:00:00 -0.1153333
2 2007-09-30 01:00:00 -0.4006667
3 2007-09-30 02:00:00 -0.4493333
4 2007-09-30 03:00:00 -0.7540000
5 2007-09-30 04:00:00 -0.5783333
6 2007-09-30 05:00:00 -0.3280000
like image 854
f.ashouri Avatar asked Dec 05 '25 02:12

f.ashouri


1 Answers

We added a number of tests for automatic conversion of types to the package, see the source tarball. In particular, the conversion of SQL Datetime to POSIXct was a prime motivation for me to get the package started (as a GSoC project).

But we may simply not writing back the same way you did here. So if it complains about a missing converter for POSIXct, try converting the POSIXct column(s) to numeric, and then provide a reproducible example on the rpostgresql mailing list (see the code.google.com repo and wiki).

like image 79
Dirk Eddelbuettel Avatar answered Dec 07 '25 17:12

Dirk Eddelbuettel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!