Questions tagged [plr]

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

36 questions
0
votes
1 answer

how to write dataframe as table in the db in plr

I would like to write back a dataframe to the db in plr. In standard R I could just do: require("RPostgreSQL") con <- dbConnect(dbDriver("PostgreSQL"), dbname = , port = , user = ) data(iris) dbWriteTable(con, 'iris', iris, row.names=FALSE) In…
SunWuKung
  • 527
  • 4
  • 16
0
votes
1 answer

convert character string into R integer vector

I receive a character string "{1,0,0,0,0,0}" created as a textual representation of a vector (integer[]) by postgresql and have to cast it into a R integer/numeric vector. Is there any efficient way to convert v into a R representation of a…
user1612798
  • 702
  • 1
  • 5
  • 8
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
1 answer

PL/R (plr) returns an error when using dbSendQuery twice in a function; "plr_cursor" already exists

I installed PL/R (plr) and extended my database with it. I created a function that creates a pdf print from a plot. The data is queried from my PostgreSQL database: CREATE OR REPLACE FUNCTION f_graph() RETURNS text AS ' require(RPostgreSQL) drv <-…
Stefan
  • 1,383
  • 2
  • 15
  • 25
0
votes
1 answer

PL/R does not find shared library after install on postgres 9.2

I am trying to get PL/R running on a linux server where I do not have root access. The installation itself works fine using the command below: LD_INCLUDE_PATH="$HOME/pgsql/include" LD_LIBRARY_PATH="$HOME/pgsql/lib:$HOME/lib/R/lib"…
yellowcap
  • 3,985
  • 38
  • 51
-1
votes
1 answer

R linear model (lm) predict function with one single array

I have an lm model in R that I have trained and serialized. Inside a function, where I pass as input the model and a feature vector (one single array), I have: CREATE OR REPLACE FUNCTION lm_predict( feat_vec float[], model bytea ) RETURNS…
strv7
  • 109
  • 10
1 2
3