search for: rconnect

Displaying 20 results from an estimated 76 matches for "rconnect".

Did you mean: connect
2006 Oct 09
1
Discussion starter for package level Connection API
Thought I'd try and start a discussion. Feel free to jump in. I guess R needs to strike the right balance between opening up the internals to package writers and not allowing them to do bad things. My first attempt at cracking this nut is to just memcpy() the Rconnection and not allow access to the private stuff: /* Alternative to allowing C code access to connection API. */ Rconnection R_GetConnection(Rconnection ucon, int idx){ Rconnection rcon; /* Valid connection? */ if ((rcon = getConnection(idx)) == NULL) return NULL; memcp...
2005 Aug 22
2
RFC: "loop connections"
...connections.c 2005-08-22 15:54:03.156038200 -0700 @@ -1644,13 +1644,13 @@ return ans; } -/* ------------------- text connections --------------------- */ +/* ------------------- loop connections --------------------- */ /* read a R character vector into a buffer */ static void text_init(Rconnection con, SEXP text) { int i, nlines = length(text), nchars = 0; - Rtextconn this = (Rtextconn)con->private; + Rloopconn this = (Rloopconn)con->private; for(i = 0; i < nlines; i++) nchars += strlen(CHAR(STRING_ELT(text, i))) + 1; @@ -1668,19 +1668,35 @@ this->cur...
2007 May 20
0
Problems accessing Rconnect
...he guidance given on http://rosuda.org/Rserve/example.shtml I tried to follow the first example but I am getting an error descirbed below. My IDE looks like this: http://www.nabble.com/file/p10705244/ide.jpg However, when I try and compile my java file I get the following error: Cannot access Rconnection bad class file: C:\org\rosuda\JRclient\Rconnection.class class file contains wrong class: org.rosuda.JRclient.Rconnection Please remove or make sure it appears in the correct subdirectory of the classpath. Rconnection c = new Rconnection(); ^ I am not quite sure I am doing wrong...
2005 Aug 22
1
Fetching Warning Messages
...ow is my Java Program, which uses withCallingHandlers of R : import org.rosuda.JRclient.*; ---------------------------RWarning.java----------------------- class RWarning { public static void main(String args[]) { try { String hostName = null; hostName = args[0]; Rconnection c = new Rconnection(hostName); c.voidEval("lastWarning <- NULL"); c.voidEval("withCallingHandlers( {x<-sqrt(-9);y<-matrix(1:9,ncol=4);z<-sqrt(4)} , warning = function (w) { lastWarning <<- paste(lastWarning,as.character(w))})"); //This will gen...
2009 Jun 12
0
JRclient.RSrvException Exception: Handshake
...t work properly. Now im trying to establish a connection by using Rserve and JRclient (RF503). I have the following code, which i`ve found: ------------------------------------------------------------------------ public class RTester { public static void main(String[] args) { Rconnection c = getLocalRconnection(); if (c != null) { try { double[] d = c.eval("rnorm(10)").asDoubleArray(); for (double n : d) System.out.println(n); } catch (RSrvException e) { e.printStackTrac...
2005 Sep 18
0
Updated rawConnection() patch
...XP do_clearpushback(SEXP, SEXP, SEXP, SEXP); SEXP do_textconnection(SEXP, SEXP, SEXP, SEXP); +SEXP do_graboutput(SEXP, SEXP, SEXP, SEXP); SEXP do_getallconnections(SEXP, SEXP, SEXP, SEXP); SEXP do_sumconnection(SEXP, SEXP, SEXP, SEXP); SEXP do_download(SEXP, SEXP, SEXP, SEXP); --- ./src/include/Rconnections.h.orig 2005-08-03 08:50:36.000000000 -0700 +++ ./src/include/Rconnections.h 2005-09-17 23:56:01.875475000 -0700 @@ -94,8 +94,7 @@ typedef struct outtextconn { int len; /* number of lines */ - SEXP namesymbol; - SEXP data; + SEXP namesymbol, data, venv; char *lastline;...
2017 Oct 26
3
How to create a table structure in Java code?
...tring inputIris = "5.1,3.5,1.4,0.2,setosa\n" + "4.9,3,1.4,0.2,setosa\n" + "4.7,3.2,1.3,0.2,setosa\n" + "4.6,3.1,1.5,0.2,setosa\n" + "5,3.6,1.4,0.2,setosa\n" + "5.4,3.9,1.7,0.4,setosa\n" + "4.6,3.4,1.4,0.3,setosa"; REXP irisData =rConnection.eval( "read.csv(textConnection(" + inputIris + "), header = FALSE)"); Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email. > -------- Original Message -------- > Subject: Re: [Rd] How to create a table structure in Java code? > Local Time: O...
2017 Oct 25
2
How to create a table structure in Java code?
...Read = "data.frame(5.1,3.5,1.4,0.2,setosa\n" + "4.9,3,1.4,0.2,setosa\n" + "4.7,3.2,1.3,0.2,setosa\n" + "4.6,3.1,1.5,0.2,setosa\n" + "5,3.6,1.4,0.2,setosa)" ; // using parseAndEval below to give me actual error R is sending... REXP rResponseObject = rConnection.parseAndEval("try(eval("+tableRead+"),silent=TRUE)"); if (rResponseObject.inherits("try-error")) { System.out.println("R Serve Eval Exception : "+rResponseObject.asString()); } REXP boxMResult = rConnection.eval("boxM("+ tableRead+ "[,-...
2009 Mar 19
4
Import R-output into Java
Hello, I want to import R-output via Rserve to Java, especially for the function ctree from the package party. Rserve is working properly. Yet, I only get the predictions with the Java code try{ RConnection c = new RConnection(); ... c.voidEval("modell <- ctree(...)"); REXP y = c.eval("nodes(modell,1)[[1]]$prediction"); ... }catch(Exception e){} When I try to get the whole text with REXP z = c.eval("nodes(modell,1)[[1]]"); Syst...
2009 Nov 07
1
getConnection, R_outpstream_st
Hello, I'm trying to use the limited connections api defined in Rinternals.h. I have code that looks like this (inspired from do_serializeToConn) : SEXP serialize_to_connection( SEXP xp, SEXP connection ){ Rconnection con ; struct R_outpstream_st out; R_pstream_format_t type = R_pstream_binary_format ; SEXP (*hook)(SEXP, SEXP) = NULL ; con = getConnection(Rf_asInteger(connection)); R_InitConnOutPStream(&out, con, type, 0, hook, R_NilValue ); return R_NilValue ; } The problem I have is that I cannot ac...
2018 Dec 04
3
patch to support custom HTTP headers in download.file() and url()
...s. * We have run the tests on macOS, Debian Linux and Windows 2016 Server. You can also browse the changes here: https://github.com/gaborcsardi/r-source/pull/3/files You can also download the diff below from https://github.com/gaborcsardi/r-source/pull/3.diff Best, Gabor diff --git a/src/include/Rconnections.h b/src/include/Rconnections.h index a2c53f058f..32bb35e31f 100644 --- a/src/include/Rconnections.h +++ b/src/include/Rconnections.h @@ -36,6 +36,7 @@ typedef enum {HTTPsh, FTPsh, HTTPSsh, FTPSsh} UrlScheme; typedef struct urlconn { void *ctxt; UrlScheme type; + char *headers; }...
2017 Oct 26
1
How to create a table structure in Java code?
...ect.org > To: Morkus <morkus at protonmail.com> > Jan van der Laan <rhelp at eoos.dds.nl>, r-devel at r-project.org <r-devel at r-project.org> > > You are entering the quoting hell - you are missing quotes and escapes for \n. it would be much more reasonable to use the rConnection.assign method instead of pasting any content through the parser. > > Cheers, > Simon > >> On Oct 26, 2017, at 9:59 AM, Morkus via R-devel r-devel at r-project.org wrote: >> That's amazing! Thank you!!! >> One follow up question, if that's OK? >> If, in...
2017 Oct 27
4
Cannot Compute Box's M (Three Days Trying...)
...sly, since I can easily compute the Box's M right there in RStudio But I don't see what is wrong below with the coding equivalent. The entire code snippet is below. The code fails below on the call to the boxM statistic call. PLEASE HELP!!! Thanks in advance, ------------------------- rConnection.eval("library('biotools')"); String inputIris = "5.1,3.5,1.4,0.2,setosa\n" + "4.9,3,1.4,0.2,setosa\n" + "4.7,3.2,1.3,0.2,setosa\n" + "4.6,3.1,1.5,0.2,setosa\n" + "5,3.6,1.4,0.2,setosa\n" + "5.4,3.9,1.7,0.4,setosa\n" +...
2017 Oct 28
2
Cannot Compute Box's M (Three Days Trying...)
I'm not sure what you mean. Could you please be more specific? If I print the string, I get: boxM(boxMVariable[, -5], boxMVariable[, 5]) From this code: . . . // assign the data to a variable.rConnection.assign("boxMVariable", myDf); // create a string command with that variable name.String boxVariable = "boxM(boxMVariable[, -5], boxMVariable[, 5])"; System.out.println(boxVariable); // print the string? Not sure what is meant. Sorry if I didn't understand your suggest...
2017 Oct 26
0
How to create a table structure in Java code?
You are entering the quoting hell - you are missing quotes and escapes for \n. it would be much more reasonable to use the rConnection.assign method instead of pasting any content through the parser. Cheers, Simon > On Oct 26, 2017, at 9:59 AM, Morkus via R-devel <r-devel at r-project.org> wrote: > > That's amazing! Thank you!!! > > One follow up question, if that's OK? > > If, instead o...
2009 Mar 11
1
RServe
Dear all, I'm trying to use R-functions from Java. I want to use the Package Rserve. Everthing is installed and I can run my Java-testprogramm. ... Rconnection r = new Rconnection(); double[] d = r.eval("rnorm(10)").asDoubleArray(); ... But now I get always arrays with ten "0.0", which is not correct I suppose, that is is a problem from R, because at the fist time (last week) I started RServe I got an icon in my taskbar which was...
2007 Aug 27
1
fix for broken largefile seek() on 32-bit linux (PR#9883)
...2664) +++ src/extra/zlib/gzio.c (working copy) @@ -25,7 +25,7 @@ #include "zutil.h" /* R ADDITION */ -#if defined(HAVE_OFF_T) && defined(HAVE_SEEKO) +#if defined(HAVE_OFF_T) && defined(HAVE_FSEEKO) #define f_seek fseeko #define f_tell ftello #else Index: src/include/Rconnections.h =================================================================== --- src/include/Rconnections.h (revision 42664) +++ src/include/Rconnections.h (working copy) @@ -63,7 +63,7 @@ typedef struct fileconn { FILE *fp; -#if defined(HAVE_OFF_T) && defined(HAVE_SEEKO) +#if defined(...
2017 Oct 28
2
Cannot Compute Box's M (Three Days Trying...)
Thanks Duncan. Awesome ideas! I think we're getting closer! I tried what you suggested and got a possibly better error... . . . rConnection.assign("boxMVariable", myDf); String resultBV = "str(boxMVariable)"; // your suggestion. RESULTING ERROR: Error in format.default(nam.ob, width = max(ncn), justify = "left") : invalid 'width' argument (No idea what this means). For testing, I'm u...
2017 Oct 26
0
How to create a table structure in Java code?
...,0.2,setosa\n" + > "4.9,3,1.4,0.2,setosa\n" + > "4.7,3.2,1.3,0.2,setosa\n" + > "4.6,3.1,1.5,0.2,setosa\n" + > "5,3.6,1.4,0.2,setosa)" ; > > // using parseAndEval below to give me actual error R is sending... > REXP rResponseObject = rConnection.parseAndEval("try(eval("+tableRead+"),silent=TRUE)"); > if (rResponseObject.inherits("try-error")) > { > System.out.println("R Serve Eval Exception : "+rResponseObject.asString()); > } > REXP boxMResult = rConnection.eval("boxM(&q...
2008 Jul 02
1
Extracting regression coef. and p-values in JRClient
Hi there, I am using JRClient to build logistic regression model in the following manner : Rconnection c = new Rconnection(); c.eval("KSN<-read.table(\"/Users/amine/Documents/Research/ Tools/R/D2R1.txt\",header=T,sep=\",\")"); c.eval("result <- glm(Nausea ~ Kaletra*Sustiva, family = binomial(link = logit), data =KSN)"); I can obt...