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
1
vote
1 answer

Connect with rpostgresql

I have build up a postgresql 9.2 database. My table looks like that: CREATE DATABASE "EURUSD_M1" WITH OWNER = fadmin ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'German_Germany.1252' LC_CTYPE =…
user2051347
  • 1,609
  • 4
  • 23
  • 34
1
vote
2 answers

Can't connect to AWS Redshift using RPostgreSQL

I'm not able to connect to my AWS Redshift database using RPostgreSQL. Does anyone have an example of code that would work? library (RPostgreSQL) drv <- dbDriver("PostgreSQL") conn <- dbConnect(drv, "database.us-east-1.redshift.amazonaws.com", …
1
vote
1 answer

Rpostgresql: Properly escaping strings for input

I am bridging R and psql, wish to remove vulnerability to sql injection. Looking at documentation, I had hoped that: postgresqlExecStatement(con, statement, params, ...) Would allow use of something like: postgresqlExecStatement(con, "DELETE FROM…
shf8888
  • 255
  • 1
  • 9
1
vote
1 answer

Importing strings as factors using RPostgreSQL

I'd like to import data from a large postgresql table. In order to save space, I'd like to automatically convert textual values to factors. For instance, the dataset has many string variables such as (eg., "Male," "Female") and if these could be…
d_a_c321
  • 533
  • 1
  • 11
  • 23
1
vote
0 answers

RPostgreSql need too much RAM

I need to write a large data.table to a PostgreSql table on the same computer (Ubuntu 64bit, 16GB RAM). Before sending the following commands, the System Monitor show 47% Memory used (3% Swap), but in the middle of the long time of running…
Chris
  • 2,256
  • 1
  • 19
  • 41
1
vote
0 answers

Calling a function of RPostgreSQL in R

I am quite new in R. I am using RPostgreSQL and I would like to utilize a code to automatically write new tables to the DataBAse. I am using this code, but I don't know how I could call it. ndatatwrit <- list(n25,n28,n29,n31,n32) lapply (ndatatwrit,…
Topdombili
  • 265
  • 4
  • 10
1
vote
1 answer

Printing query timings using RPostgresql

I use RPostgresql to connect to a local Postgres DB. Usually we send the query as a string using dbGetQuery. Is there any way to print the execution time of the query ? In postgres \timing prints the query execution time for all the queries. Is…
psteelk
  • 1,305
  • 3
  • 16
  • 24
0
votes
2 answers

How to import/copy different csv files into 1 table in SQL using R?

I have multiple csv files (1 file for each city) having following structure. An example of two out of many files: CSV File 1: City_Name Pop PopDen Lit MI 45000 280 78 MI 37000 310 89 ... ... CSV File 2: City_Name Pop PopDen Lit CH …
0
votes
1 answer

Normalizing data in R - dataframe construction

I'm using R to connect to a database I have stored in PGAdmin so that I can add data into the database through R. Before adding the data into the database, it has to be normalized. The dataset consists of employee data. If an employee is a manager,…
amatof
  • 175
  • 1
  • 13
0
votes
1 answer

Using RpostgreSQL with sqldf crashes R

I am using sqldf to train some r-users in SQL. Loading RPostgreSQL or RH2 before loading sqldf will change the default SQL used by sqldf. This works fine with h2, but every time I load RPostgreSQL, R will crash on first attempted query. I want to…
Joe
  • 3,217
  • 3
  • 21
  • 37
0
votes
1 answer

WHERE Statement Throwing Error using VARCHAR

I am using the DBI package with the RPostgreSQL driver to query from an amazon redshift database and am able to pull tables with simple queries without issue. By simple queries I mean something like this: 'SELECT * FROM transactions ORDER BY…
nerrez
  • 15
  • 3
0
votes
1 answer

Creating primary key in postgresql takes days

I am trying to write my table to a PostgreSQL database then declare a primary key. My data is really huge (includes billions of rows and total size is approximately 150 GB), when I try to create a primary key after writing the table, it takes…
Samet Sökel
  • 2,515
  • 6
  • 21
0
votes
1 answer

Error in connecting to PostgreSQL in R using DBI connector

i am facing the following challenge, when i am trying to connect to the Rpostgresql using the DBI package i am getting the following error. Below is the code used for my…
0
votes
0 answers

Reading data from edbpostgres into R (date problem)

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', …
user8795501
  • 73
  • 10
0
votes
1 answer

RPostgreSQL query not working in Shiny server

I am trying to get data from a PostgreSQL database in a shiny app. The query is not working. Running the following function(input, output) { data.df<- eventReactive(input$fetcher, { qry<-paste0("\'SELECT * FROM bhavcopy WHERE \"TIMESTAMP\"…
Asitav Sen
  • 56
  • 4