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
3 answers

R PostgreSQL - data is not getting updated in the table of the database

Hi I am trying to update a postgresql table using RpostgreSQL package, the commands in R are executed successfully but the new data is not getting reflected in the database. Below are the commands i have executed in R for(i in new_data$FIPS) { drv…
0
votes
1 answer

RPostgreSQL- Insert a column into another table according to the ID

I've used RPostgreSQL to connect R and postgresQL, and I'd like to insert a column into another table according to the "pid", please advise how is can be achieved using R command: >library(RPostgreSQL) >drv<-dbDriver("PostgreSQL") >itemlist<-…
Samoth
  • 716
  • 15
  • 34
0
votes
1 answer

Connect to a PostgreSQL database in a Server from a local machine R

When you connect to PostgreSQL thorough RPostgreSQL for example I do the following. m <- dbDriver("PostgreSQL") con <- dbConnect(m, host = "localhost", user= "postgres", password="admin", dbname = "postgres") But if you want to connect to a…
Ariel
  • 157
  • 1
  • 4
  • 18
0
votes
1 answer

RPostGreSQL with maintenance-db

I'm trying to connect to a postgre database using RPostgreSQL. Here's my code : drv <- dbDriver("PostgreSQL") con <- dbConnect(drv, dbname='dbname', host='10.10.111.111', port='1983',user='user' …
Henri
  • 21
  • 2
0
votes
2 answers

R, RPostgreSQL: a vector in a query

Using RPostgreSQL package I have to do a query with a vector in the string: dbGetQuery(con, "select from id_table where id_user in tmp") Where tmp should be a list or a vector of length= 10k, how can I do this? Thanks.
0
votes
0 answers

Loaded time is without hours, minutes and seconds

i load on local computer (Mac) with RPostgreSQL file from PostgreSQL and i have time instead of "2015-02-03 12:12:12" "2015-02-03". i need true time, please help. library(RPostgreSQL) command <- "SELECT * FROM xxx;" xxx <- dbSendQuery(con,…
Shen
  • 183
  • 1
  • 10
0
votes
1 answer

skip the script if return value is zero(I mean if the dataframe has empty rows)

library(RPostgreSQL) library(ggplot2) I want to collect some data from database using Rpostgresql and want to make bar graph for it. Here is the script l1 <- dbGetQuery(con, "SELECT * FROM event_log where eventtime > '2015-05-29 06:00:00' and…
Chanti
  • 525
  • 1
  • 5
  • 15
0
votes
2 answers

R postgresql - dbWriteTable is not commiting data properly

Found a strange behaviour. I am trying to append a number of rows to an existing postgresql table with R. The new rows are to be appended to the table. dbWriteTable(con,name = "public.MyTab",value = data,row.names=F,overwrite=F, append=T) It…
Curlew
  • 1,022
  • 18
  • 39
0
votes
1 answer

why is it much faster running sql under PostgreSQL than running sql using RPostgreSQL package?

What I did is on the website How to select efficiently in a very large table I used RPostgreSQL package under R because I want to manipulate other files at the same time. As you can see from the above website, the table is very large. It will cost…
Ben
  • 665
  • 1
  • 10
  • 27
0
votes
2 answers

generating sql statements from data returned in R by Postgresql

Fist I am executing following R commands which returns me a set of records from postgresql col_qry <- paste("select column_name from table1",sep="") rs_col <- dbSendQuery(r,col_qry) temp_list <- fetch(rs_col,n=-1) The Data returned is displayed is…
user2966197
  • 2,793
  • 10
  • 45
  • 77
0
votes
1 answer

Error while executing R commands in Java for accessing data from PostgreSQL and doing computation

I am writing a Java code where in I am trying to get the data from PostgreSQL and doing simple computation on it(calculating median). First I am loading the RPostgreSQL library from Java code itself and then loading the driver and establishing the…
user2966197
  • 2,793
  • 10
  • 45
  • 77
0
votes
1 answer

How to define variables in a PL/R (plr) function as parameters for a query inside

I've written a function that queries x,y,z values for creating sections with R. Now, I want to do that with PL/R, instead of using RStudio. CREATE OR REPLACE FUNCTION section_graph() RETURNS text AS ' require(RPostgreSQL) drv <-…
Stefan
  • 1,383
  • 2
  • 15
  • 25
0
votes
2 answers

Error in dbPreExists && !overwrite : invalid 'x' type in 'x && y'

I'm executing SQL using RPostgreSQL and sqldf packages. Connection: drv <- dbDriver("PostgreSQL") con <- dbConnect(drv, dbname="dbname",host="host",port=5432,user="usr",password="pwd") Then I build a pretty complex SQL statement and at the end I…
Tomas Greif
  • 21,685
  • 23
  • 106
  • 155
-1
votes
2 answers

Similliar aggregate function to unique/distinct in R Postgres Backend

How does it work to aggregate a variable in a postgres db backend table to its unique value. For example i have the following table: library(tidyverse) library(dbplyr) dbplyr::memdb_frame(a=c(2,2,2), b=c(2,3,4)) %>% summarise(aggregatedSum =…
werN
  • 109
  • 7
-1
votes
1 answer

what is the difference between the available postgresql libraries in R?

I am using postgresql for some of my analysis and so far in R I've used the RPostgreSQL library. After a recent check I discovered that while still on CRAN, the sources are in the process of been evicted as part of the changes in google.code. Last…
Enzo
  • 2,543
  • 1
  • 25
  • 38
1 2 3
13
14