Dear all, As a java developer I prefer to develop rest services using jax-rs. Now I developed a service that executes Rscript (Using ProcessBuilder), sends text to stdin of the process and reads from stdout of the process. Works fine, but this is inefficient, because every call reloads all that is needed. I have looked into this: https://github.com/microsoft/java-client-library https://rforge.net/Rserve/ several other sources on stackoverflow etc. A lot of these sources seem old or not maintained. Now my question: Is there a preferred and maintained way to efficiently call R from Java? Preferrably available in maven central? Regards, Eduard -- Eduard Drenth, Software Architekt edrenth at fryske-akademy.nl Doelestrjitte 8 8911 DX Ljouwert +31 58 234 30 47 +31 62 094 34 28 (priv?) skype: eduarddrenth https://github.com/eduarddrenth frisian.eu gpg: https://pgp.surfnet.nl/pks/lookup?search=eduarddrenth Op freed bin ik th?s/wurkje ik minder -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20201127/7d818716/attachment.sig>
Well ... google is your friend. "calling R from Java" brought up what looked to me like useful resources, including this: https://www.cnblogs.com/mavlarn/archive/2012/12/24/2831688.html Have you done this already? Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Nov 27, 2020 at 4:01 PM Eduard Drenth <edrenth at fryske-akademy.nl> wrote:> Dear all, > > As a java developer I prefer to develop rest services using jax-rs. > > Now I developed a service that executes Rscript (Using ProcessBuilder), > sends text to stdin of the process and reads from stdout of the > process. > > Works fine, but this is inefficient, because every call reloads all > that is needed. > > I have looked into this: > > https://github.com/microsoft/java-client-library > https://rforge.net/Rserve/ > several other sources on stackoverflow etc. > > A lot of these sources seem old or not maintained. > > Now my question: Is there a preferred and maintained way to efficiently > call R from Java? Preferrably available in maven central? > > Regards, Eduard > > > -- > Eduard Drenth, Software Architekt > > edrenth at fryske-akademy.nl > > Doelestrjitte 8 > 8911 DX Ljouwert > +31 58 234 30 47 > +31 62 094 34 28 (priv?) > > skype: eduarddrenth > https://github.com/eduarddrenth > frisian.eu > gpg: https://pgp.surfnet.nl/pks/lookup?search=eduarddrenth > > > Op freed bin ik th?s/wurkje ik minder > > > > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Not being a Java programmer I was going to sit this one out, but when Bert points at an 8-year old blog that OP was already saying was too old I figure even I can Google better than that. https://github.com/oracle/fastr which has activity within the last 3 days, though I really don't know anything about it beyond that. FWIW I can't recall ever seeing mention of calling R from Java on this list before, so don't get your hopes up. Of course, that subject would in general be off topic so that isn't saying much. On November 27, 2020 4:55:39 PM PST, Bert Gunter <bgunter.4567 at gmail.com> wrote:>Well ... google is your friend. >"calling R from Java" >brought up what looked to me like useful resources, including this: >https://www.cnblogs.com/mavlarn/archive/2012/12/24/2831688.html > >Have you done this already? > >Bert Gunter > >"The trouble with having an open mind is that people keep coming along >and >sticking things into it." >-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > >On Fri, Nov 27, 2020 at 4:01 PM Eduard Drenth ><edrenth at fryske-akademy.nl> >wrote: > >> Dear all, >> >> As a java developer I prefer to develop rest services using jax-rs. >> >> Now I developed a service that executes Rscript (Using >ProcessBuilder), >> sends text to stdin of the process and reads from stdout of the >> process. >> >> Works fine, but this is inefficient, because every call reloads all >> that is needed. >> >> I have looked into this: >> >> https://github.com/microsoft/java-client-library >> https://rforge.net/Rserve/ >> several other sources on stackoverflow etc. >> >> A lot of these sources seem old or not maintained. >> >> Now my question: Is there a preferred and maintained way to >efficiently >> call R from Java? Preferrably available in maven central? >> >> Regards, Eduard >> >> >> -- >> Eduard Drenth, Software Architekt >> >> edrenth at fryske-akademy.nl >> >> Doelestrjitte 8 >> 8911 DX Ljouwert >> +31 58 234 30 47 >> +31 62 094 34 28 (priv?) >> >> skype: eduarddrenth >> https://github.com/eduarddrenth >> frisian.eu >> gpg: https://pgp.surfnet.nl/pks/lookup?search=eduarddrenth >> >> >> Op freed bin ik th?s/wurkje ik minder >> >> >> >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.-- Sent from my phone. Please excuse my brevity.
Hi Eduard,> Now I developed a service that executes Rscript (Using ProcessBuilder), > sends text to stdin of the process and reads from stdout of the > process.This doesn't answer your question, but may be relevant. I have a java-based application that works on a similar principle. (The code is horrendously bad and most of it should be thrown away). I'm planning to write a terminal emulator, in the near future. (Currently, second place on my top-level todo list). The primary objective is to build object-oriented and message passing APIs on top of the core terminal emulation system, with at least some cross platform functionality. Noting that, in my opinion, the cross-platform aspect is more important for R, than in many other IPC topics. Hence, I'm interested in hearing "wishlist" items for such APIs.