Chupica
7/9/2018 - 7:29 PM

Create tables in DB with R

library(RPostgreSQL)  # loads the PostgreSQL driver  
drv <- dbDriver("PostgreSQL")  # creates a connection to the postgres database  # note that "con" will be used later in each connection to the database  
con <- dbConnect(drv, dbname = "osd_analysis", host = "localhost", port = 5432)  
dbWriteTable(con, c("osd_analysis", "bgc_graph_c1_metadata"), value=dt,overwrite=TRUE,row.names=FALSE)