-------- 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"?