I have a problem with importing data from edb postgres into R (with RPostgres). I using this code:
library(RPostgres)
conn <- dbConnect(Postgres(), dbname = 'xx', host = 'xx', port = 'xx',
user = 'xx', password = 'xx',
options="-c search_path=xx")
a=dbGetQuery(conn, "SELECT * FROM xx")
After importing data into R is all Ok exept all column with date which become corruped. A few exemples:
postgres value: 2009-11-02 after importing in R: 0231-08-11
postgres value: 2009-08-12 after importing in R: 1206-01-15
data type in postgres for this column is date. If I read from postgres column (date) with query:
".. to_char(column_with_date, 'DD-MM-YYYY') as column_with_date .."
then I get ok data in R but data type in R is not date but character.
I tried the same with importing the same data from mysql base into R (with RMySQL) and in this case data are noncorrupted . Used code:
library(RMySQL)
conn <- dbConnect(MySQL(), user = "xx", password = "xx", dbname = "xx", host = "xx" )
a=dbGetQuery(conn,"select* from xx ")
Thank you