Rmath-Java is a Java wrapper of the Rmath library from R, which contains functions related to statistical distributions.
This library uses JNA to call native code in Rmath. See the next section for download link of JNA.
- JNA (4.2.0)
- Rmath-Java for Windows and 64-bit Linux. For other systems and architectures, the jar file can be built from source.
To build Rmath-Java from source, one needs:
- GCC/Clang compiler
- JDK
- make
Then simply enter the source directory and type make
.
For Java,
import statr.rmath.Rmath;
public class TestRmath {
public static void main(String[] args) {
System.out.println("dnorm(1.2, mu = 3.4, sd = 5.6) = " +
Rmath.dnorm(1.2, 3.4, 5.6));
}
}
or in Scala,
import statr.rmath.Rmath
Rmath.dnorm(1.2, 3.4, 5.6)
Rmath-Java includes code from the R project which is licensed under GPL (>= 2). Rmath-Java itself is also licensed under GPL (>= 2).