I would like to be able to run "R" language scripts in B4J.
My B4J code pulls data from a database according to user parameters. The next step is to analyze the data and visualize the result using heat maps and line charts,
There are many well developed R scripts that do statistical analysis and visualization.
How do I run and send data to an external R process, then received the result back for displaying in B4J?
I am currently trying to implement a Renjin script engine library interface so you can run the script from java.
I don't understand 'R' so its a bit slow lol
Got it running so it understands the following (although I don't)
B4X:
Dim engine As jInvokeR
engine.init
engine.Eval("df <- data.frame(x=(1:10) , y=(1:10)+rnorm(n=10))")
engine.Eval("print(df)")
engine.Eval("print(lm(y ~ x, df))")
which produces the following output
x y
1 1 2.537
2 2 3.673
3 3 1.854
4 4 3.946
5 5 5.204
6 6 7.17
7 7 7.038
8 8 10.119
9 9 8.583
10 10 8.538
Call:
lm(formula = y ~ x, data = df)
Coefficients:
(Intercept) x
1.168 0.854