Questions tagged [plr]

PostgreSQL support for R as a procedural language (PL).

36 questions
1
vote
0 answers

PostgreSQL: PL/R does not work as expected

Using this tutorial of BostonGIS, I installed PL/R as an extension in my PostgreSQL 9.5 (x64) DB at Windows 7 Enterprise (x64) machine. After installation, I tested PL/R by running: SELECT * FROM plr_environ(); and it returned environment…
khajlk
  • 791
  • 1
  • 12
  • 32
1
vote
1 answer

PostgreSQL ERROR: invalid input syntax for integer: "1e+06"

The full error message is: ERROR: invalid input syntax for integer: "1e+06" SQL state: 22P02 Context: In PL/R function sample The query I'm using is: WITH a as ( SELECT a.tract_id_alias, array_agg(a.pgid ORDER BY a.pgid) as pgids, …
Kevin M
  • 801
  • 3
  • 9
  • 14
1
vote
1 answer

Root mean square deviation on binned GAM results using R

Background A PostgreSQL database uses PL/R to call R functions. An R call to calculate Spearman's correlation looks as follows: cor( rank(x), rank(y) ) Also in R, a naïve calculation of a fitted generalized additive model (GAM): data.frame( x,…
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
1
vote
1 answer

PL/R - Pass entire column as an argument

I am trying to write a simple PL/R function that finds the mean of a column (Greenplum 4.3.4 DB) CREATE OR REPLACE FUNCTION mean_plr(val numeric[]) RETURNS numeric AS $$ x <- val avg = mean(x) return(avg) $$ LANGUAGE 'plr'; SELECT mean_plr(sensor1)…
Shubham Saini
  • 738
  • 3
  • 8
  • 18
1
vote
1 answer

kmeans clustering using PL/R in postgresql

I am trying to use kmeans function in PL/R. I have created following table CREATE TABLE EMP (NAME1 TEXT, AGE SMALLINT, SALARY NUMERIC ); INSERT INTO EMP VALUES ('Joe', 41, 55000), ('Jill', 27, 25000), ('Jack', 31, 45000), ('Joker', 65,…
Krishna Das
  • 91
  • 1
  • 6
1
vote
2 answers

How to install PL/R on Mountain Lion? make searching wrong path?

I'm trying to install PL/R on Mountain Lion 10.8.2, I've installed R 2.15.3 from r-project and PostgreSQL 9.1 from KyngChaos. I've got PL/R 8.3.0.14 from http://www.joeconway.com/plr/. I've put the expanded folder in /usr/local/pgsql/share/contrib…
duncandoo
  • 313
  • 2
  • 6
1
vote
2 answers

PLR Installation on Mac Lion

I am trying to install PL/R 8.3.0.13.1 on my MacBook Pro running OS X 10.7.5, Postgres 9.2 and R 2.15.2. I have found on the web a nice step-by-step guide for Windows but I can't find anything similar for Mac. I got stuck when I run this command…
CptNemo
  • 6,455
  • 16
  • 58
  • 107
0
votes
1 answer

persistent data store between calls in plr

I have a web application that talks to R using plr when doing adaptive testing. I would need to find a way to store static data persistently between calls. I have an expensive calculation creating an item bank than a lot of cheap ones getting the…
SunWuKung
  • 527
  • 4
  • 16
0
votes
1 answer

how can I run r function from package in postgresql

I am trying to use the R function from a R package (https://cran.microsoft.com/snapshot/2017-04-03/web/packages/genasis/index.html) directly in Postgres without rewriting the function again, so it could be like: CREATE OR REPLACE FUNCTION funcname…
Mazenis
  • 3
  • 2
0
votes
2 answers

Using geom_function in ggplot2 to call a function written in postgreSQL plr

I struggle to call a plr function in postgreSQL from a R-script and use it in ggplot2 - geom_function. The following examples are extremly simplified but hopefully show the issue. Let's assume I have the following plr function: CREATE OR REPLACE…
bthebread
  • 253
  • 1
  • 8
0
votes
1 answer

Passing a vector as argument in pl/r to initiate a for loop

Need to initiate a for loop using a vector argument in pl/r. The code is as below: DROP TYPE IF EXISTS tsdata CASCADE; CREATE TYPE tsdata AS ( a text, b text, c text, d text ); DROP FUNCTION IF EXISTS standard.create_pd_ts(data char,…
Bruce Wayne
  • 471
  • 5
  • 18
0
votes
1 answer

plr.dll: %1 is not a valid Win32 application

I have Postgres version 10 installed running under windows 10 enterprise using the pl/r interface. It has been working nicely up till now. Now I get ERROR: could not load library "C:/Program Files/PostgreSQL/10/lib/plr.dll": %1 is not a valid…
Judit
  • 114
  • 1
  • 3
  • 10
0
votes
0 answers

Same seed, PL/R vs. R, different results (Random Forest)

I have an R function that takes some input data that contains missing values, uses Random Forest imputation to impute those values (through the rfImpute function from RandomForest package) and then goes through a RF importance calculation to…
Grint
  • 101
  • 2
0
votes
1 answer

Error when creation PLR extension Postgres

I'm trying to create PLR extension in Postgres 10.4 and it gives me error: ERROR: could not load library "C:/Program Files/PostgreSQL/10/lib/plr.dll": The specified module could not be found. SQL state: XX000 I use Windows 10, R 3.4.2. I…
Nata
  • 171
  • 3
  • 15
0
votes
1 answer

Error: Unable to create extension PLR in PostgreSQL

Well this issue has been a long problem for me. I am using PostgreSQL 9.5 (x64) on Windows 7 Enterprise (x64) and I have been running into problems when I try to run create extension plr;. I used this link to donwload plr for windows. Copied all the…
khajlk
  • 791
  • 1
  • 12
  • 32