Questions tagged [rpostgresql]

An R interface to the PostgreSQL database system

RPostgreSQL is an package providing an interface to databases. RPostgreSQL uses the interface which is also used by the packages , , , and .

Repositories

Other resources

Related tags

210 questions
0
votes
1 answer

Using RPostgreSQL to list the databases

I am looking for an R command to list the available databases in a PostgreSQL server. I am using RPostgreSQL package in R. I know how to connect to the server but the only thing I need to know is how to list the names of available databases.
0
votes
1 answer

Importing big database to PostgreSQL from R via RPostgreSQL library

I need import a 10.352.223 KB data base in PostgresSQL. I am trying to do it via RPostgreSQL library in R, but I have had problems. My code is: i<-10000 for(a in seq(0,36000000, i)){ data<-read.table("data.txt",sep="|",dec=",", …
fcochaux
  • 135
  • 1
  • 13
0
votes
1 answer

how to use dplyr and RPostgreSQL to connect r to redshift?

I am trying to connect R to Redshift using dplyr and RPostgreSQL based on the method from https://blogs.aws.amazon.com/bigdata/post/Tx1G8828SPGX3PK/Connecting-R-with-Amazon-Redshift Now I know my database, host port, user and password. So, here is…
Feng Chen
  • 2,139
  • 4
  • 33
  • 62
0
votes
2 answers

R language unable to insert in postgresql using postgresqlWriteTable

I am new to R and trying to insert R dataframe in Postgresql. Everytime whenever i try to execute my rscripts.R, I am getting the following error: "In postgresqlWriteTable(conn, name, value, ...) : table customervalidation exists in database:…
Praveen Kumar
  • 190
  • 5
  • 15
0
votes
1 answer

rpostgreSQL: Overwrite the data based on the time

Our finance team is using shiny app to upload the csv file to postegreSQL monthly. Sometimes, they need to revise the data and then upload again. Let's have some example to make the problem easier to understand: # Retrieve data from…
Samoth
  • 716
  • 15
  • 34
0
votes
1 answer

Cannot connect to Amazon PostgreSQL RDS database on R using RPostgreSQL

I am having trouble connecting to my Amazon RDS PostgreSQL database using R on RStudio and using the package RPostgreSQL. I am running: library("RPostgreSQL") drv <- dbDriver("PostgreSQL") con <- dbConnect(drv, dbname="mydbname", …
cullan
  • 280
  • 3
  • 13
0
votes
1 answer

How to write and read binary data with RPostgresql

I am trying to execute the code: Connect to the server library('RPostgreSQL', quietly = TRUE) kHostName <- '...' kPort <- '5432' kDBName <- '...' kUser <- '...' kPassword <- '...' drv <- dbDriver("PostgreSQL") con <- dbConnect(drv, …
dStack
  • 73
  • 1
  • 7
0
votes
2 answers

Can I import PostGIS raster data type into R by using the RPostgreSQL-package?

I have a PostgreSQL / PostGIS table with 30 rows (only 3 are shown) and 3 columns as follows (raster is a PostGIS data type) - It's the EFSA CAPRI data set btw, if somebody's fimilar with it: // Can I import the raster data type from PostGIS into R…
andschar
  • 3,504
  • 2
  • 27
  • 35
0
votes
0 answers

RPostgres not setting correct character encoding

I'm trying to get some data from a Postgres DB via the RPostgreSQL package. The character columns in the resulting data.frame have an unknown encoding: Encoding(raw_orders$city) [1] "unknown" "unknown" "unknown" "unknown" "unknown" "unknown"…
RoyalTS
  • 9,545
  • 12
  • 60
  • 101
0
votes
1 answer

Get object name after passed to function, and used in for loop, in R

This question is asked here In R, how to get an object's name after it is sent to a function? However, this doesn't work when in a for loop. For example the following method will write multiple dataframes to a postgresql database,…
Cybernetic
  • 12,628
  • 16
  • 93
  • 132
0
votes
2 answers

Read a PostgreSQL local file into R in chunks and export to .csv

I have a local file in PostgreSQL format that I would like to read into R into chunks and export it as .csv. I know this might be a simple question but I'm not at all familiar with PostgreSQL or SQL. I've tried different things using R libraries…
rafa.pereira
  • 13,251
  • 6
  • 71
  • 109
0
votes
1 answer

How can I write in RPostgreSQL's dbListTables() function to get the same results as PostgreSQL's native /dt *name_pattern* command?

I have connected to my company's PostgreSQL database using the RPostgarSQL package. I would like to list tables that match certain naming patterns using the dbListTable() function. In native PostgreSQL environment, I can just use psql command \dt…
QY Luo
  • 331
  • 1
  • 4
  • 11
0
votes
1 answer

Keep alive function for PostgreSQL connection in Shiny app?

I have a shiny app that utilizes RPostgreSQL to connect to database & queries data ad-hoc. # Initialize environment to hold SQL parameters: library(RPostgreSQL) if (!exists('.sql')) .sql <- new.env() .sql$cxn <- dbConnect(PostgreSQL(), host =…
Ray
  • 3,137
  • 8
  • 32
  • 59
0
votes
1 answer

Split a big file from a database by date

I am reading a big data file from a database (test1). Millions of rows that I cannot read and processed directly in R. I would like to create sub-files from this big file based on the column "horodatage". I gave an example below to extract one file…
virginie
  • 35
  • 7
0
votes
1 answer

Postgresql - how to make use of loop (or apply in r) to decrease the r-script size

I have two tables in my database. The columns in both tables and their datatypes are shown below. let say both tables store the data of 3 machines. Each machine has two s_id's and by using them i will select the required data of a particular…
Chanti
  • 525
  • 1
  • 5
  • 15
1 2 3
13
14