Fixed whitespace formatting.
This commit is contained in:
@@ -10,19 +10,24 @@ import java.net.URISyntaxException;
|
||||
*/
|
||||
public class FastRMean {
|
||||
|
||||
/**
|
||||
* Invokes the customMean R function passing the given values as arguments.
|
||||
*
|
||||
* @param values the input to the mean script
|
||||
* @return the result of the R script
|
||||
*/
|
||||
public double mean(int[] values) {
|
||||
Context polyglot = Context.newBuilder().allowAllAccess(true).build();
|
||||
String meanScriptContent = RUtils.getMeanScriptContent();
|
||||
polyglot.eval("R", meanScriptContent);
|
||||
Value rBindings = polyglot.getBindings("R");
|
||||
Value rInput = rBindings.getMember("c").execute(values);
|
||||
return rBindings.getMember("customMean").execute(rInput).asDouble();
|
||||
}
|
||||
/**
|
||||
* Invokes the customMean R function passing the given values as arguments.
|
||||
*
|
||||
* @param values the input to the mean script
|
||||
* @return the result of the R script
|
||||
*/
|
||||
public double mean(int[] values) {
|
||||
Context polyglot = Context.newBuilder()
|
||||
.allowAllAccess(true)
|
||||
.build();
|
||||
String meanScriptContent = RUtils.getMeanScriptContent();
|
||||
polyglot.eval("R", meanScriptContent);
|
||||
Value rBindings = polyglot.getBindings("R");
|
||||
Value rInput = rBindings.getMember("c")
|
||||
.execute(values);
|
||||
return rBindings.getMember("customMean")
|
||||
.execute(rInput)
|
||||
.asDouble();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user