[Rd] Cannot Compute Box's M (Three Days Trying...)

Duncan Temple Lang dtemplelang at ucdavis.edu
Sun Oct 29 14:56:42 CET 2017


The SJava package from 18 years  ago did (does) have bidirectional calls
from R to Java and Java to R. So you are not pushing
the interface somewhere it doesn't want to go.   But you are going about it
with strings and R syntax which is a much less powerful approach
than working with actual objects and function calls, and as you are finding
out, very cumbersome.   And it helps to know both R and Java well.
You might take a look at the SJava or rJava packages and see how they do
this. But you have to do your own homework first before asking questions
you can answer yourself.

Best,
 Duncan (TL)


On Sun, Oct 29, 2017 at 6:01 AM Morkus via R-devel <r-devel at r-project.org>
wrote:

> Hey Duncan,
>
> Since Java is the #1 language and R is extremely popular, I think the most
> telling thing is that nobody on the "R-devel" forum (where people do
> "programming with R") is doing R and Java like I'm doing: calling R from
> Java and passing data structures.
>
> So it appears I'm clearly pushing R somewhere it doesn't want to go. And,
> the boxM issue is more or less debug-proof at this moment.
>
> Perhaps I'll need to off-shore this issue for resolution for a few hundred
> bucks? I'm at the point now where I probably need to just pay somebody to
> get this crazy BoxM thing working! :(
>
> Thanks again,
>
> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
> email.
>
> > -------- Original Message --------
> > Subject: Re: [Rd] Cannot Compute Box's M (Three Days Trying...)
> > Local Time: October 29, 2017 7:45 AM
> > UTC Time: October 29, 2017 11:45 AM
> > From: murdoch.duncan at gmail.com
> > To: Morkus <morkus at protonmail.com>
> > r-devel at r-project.org <r-devel at r-project.org>
> >
> > On 29/10/2017 7:26 AM, Morkus wrote:
> >
> >> Thanks Duncan. I can't tell you how helpful all your terrific replies
> >> have been.
> >> I think the biggest surprise is that nobody appears to be using Java and
> >> R together like I"m trying to do. I suppose it should be a surprise
> >> since there are no books on the subject and almost no technical
> >> documentation other than a few sites here and there.
> >> ---------------------------------------------------------------
> >>
> >> I originally had the "int" as the return type for the factors, but that
> >> didn't make any difference.
> >> So, let me ask you. What I can get working is calling an R Script from
> >> Java. Literally opening the ".R" file and reading it line by line and
> >> evaluating it. That works. Is there any reason why that's not a viable
> >> way to go?
> >>
> >> I can't answer this very specifically, because it depends so much on
> >> your circumstances. But why bother with the file system at all?
> >> Presumably if you can read a string, you can construct the same string
> >> within your Java program (perhaps as a literal string, perhaps by
> >> building it from local variables).
> >> The one thing I don't know how to do is pass a parameter to an RScript
> >> from Java. Is it possible to pass a parameter to an RScript from Java?
> >> If I can pass a parameter to an RScript, then it's not static and I
> >> could use it as a "function" to call for different values.
> >> Look forward to your reply.
> >>
> >> I can't really answer that question, since I have no experience at all
> >> in calling R from Java. But if you want to pass a parameter named "x"
> >> with value 123 from Java to R, why not just construct and evaluate the
> >> statement "x <- 123"?
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
-- 
Duncan Temple Lang
Director, Data Science Initiative
Professor of Statistics

	[[alternative HTML version deleted]]



More information about the R-devel mailing list