I'm running R on a Windows machine which is directly linked to a PostgreSQL database. I'm not using RODBC. My database is encoded in UTF-8 as confirmed by the following R command:
dbGetQuery(con, "SHOW CLIENT_ENCODING")
# client_encoding
# 1 …
When using RPostgreSQL I find that I cannot use sqldf in the same way. For example if I load the library and read in data into a data frame using the following code:
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv,…
I have RHEL 6.5 Server with an installation of R (3.1.1) & RStudioServer (0.98.1062)
I have postgresql-9.3 installed and handling a large database. In order to connect R to PostgreSQL, I have in the past used the RPostgreSQL (still do on my CentOS 7…
I need to update column values conditionnaly on other columns in some PostgreSQL database table. I managed to do it writing an SQL statement in R and executing it with dbExecute from DBI package.
library(dplyr)
library(DBI)
# Establish connection…
When I try on linux in R
install.packages('RPostgreSQL')
it fails with unspecified errors:
Warning message:
In install.packages("RPostgreSQL") :
installation of package ‘RPostgreSQL’ had non-zero exit status
I tried to solve problem…
The dbWriteTable function in RPostgreSQL seems to ignore column names and tries to push data from R to PostgreSQL as-is. This is problematic when appending to existing tables, particularly if there are columns un-specified in the R object that…
I'm trying to insert data into a pre-existing PostgreSQL table using RPostgreSQL and I can't figure out the syntax for SQL parameters (prepared statements).
E.g. suppose I want to do the following
insert into mytable (a,b,c) values ($1,$2,$3)
How do…
I'm trying to use the large object (https://www.postgresql.org/docs/10/largeobjects.html) feature of PostgreSQL in R, and I have some trouble writing and reading using {DBI}/{RPostgres}.
Here is what I have tried so far:
# Getting the db
docker run…
I have an API built with R plumber that connects to a PostgreSQL database using RPostgreSQL and pool (although this would also apply if I was using a Shiny app):
# create the connection pool
pool <- dbPool(
drv = PostgreSQL(),
host =…
I am using R on Windows to connect to a PostgreSQL database hosted on AWS. The database is set up using forcessl = 1 - this means that any connection needs to be set up with sslmode=require.
The base RPostgreSQL package does not provide any exposure…
I am trying to connect to a remote PostgreSQL database from within R using the RPostgreSQL package, and I am getting errors that appear to be related to the SSL settings for the connection. I have verified that I can connect from the command line…
In perl/python DBI APIs have a mechanism to safely interpolate in parameters to an sql query. For example in python I would do:
cursor.execute("SELECT * FROM table WHERE value > ?", (5,))
Where the second parameter to the execute method is a…
I am trying to connect to a PostgreSQL database using the R ODBC drivers in RStudio. For some reason, the drivers are not being detected by R:
$ Rscript -e 'odbc::odbcListDrivers()'
[1] name attribute value
<0 rows> (or 0-length…
Following on from this question and subsequent answers:
Appropriate values for -Infinity & Infinity in Postgres
and the documentation, it seems clear that the real and double precision number types support both positive and negative infinity.…