Package de.fzi.power.regression.r.io
Class RRegressionConnectionImpl
- java.lang.Object
-
- de.fzi.power.regression.r.io.RRegressionConnectionImpl
-
- All Implemented Interfaces:
IRConnection,RRegressionConnection
public class RRegressionConnectionImpl extends Object implements RRegressionConnection
-
-
Constructor Summary
Constructors Constructor Description RRegressionConnectionImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(String name, double[] array)Stores an array in a R variable.voidassign(String name, int[] array)Stores an array in a R variable.voidassign(String name, String[] array)Stores an array in a R variable.voidcheckPackageAvailability(String packageName)Checks the availability of the package with the given name in R.Vector<org.rosuda.REngine.REXP>execute(String rCommands)Executes the command(s) in R.static RRegressionConnectiongetRRegressionConnection()protected voidinitalizeConnection()Initializes the connection to a R engine.static booleanisEngineAvailable()checks if an R engine could be found and the connection is established.
-
-
-
Method Detail
-
getRRegressionConnection
public static RRegressionConnection getRRegressionConnection()
-
assign
public void assign(String name, int[] array)
Description copied from interface:RRegressionConnectionStores an array in a R variable.- Specified by:
assignin interfaceRRegressionConnection- Parameters:
name- Name of the R variable in which the array is stored.array- Array to store in an R variable.
-
assign
public void assign(String name, String[] array)
Description copied from interface:RRegressionConnectionStores an array in a R variable.- Specified by:
assignin interfaceRRegressionConnection- Parameters:
name- Name of the R variable in which the array is stored.array- Array to store in an R variable.
-
checkPackageAvailability
public void checkPackageAvailability(String packageName)
Checks the availability of the package with the given name in R. If it is not available an error message is logged and displayed.- Specified by:
checkPackageAvailabilityin interfaceRRegressionConnection- Parameters:
packageName- The name of the R package.
-
initalizeConnection
protected void initalizeConnection()
Initializes the connection to a R engine.
-
execute
public Vector<org.rosuda.REngine.REXP> execute(String rCommands)
Description copied from interface:IRConnectionExecutes the command(s) in R.- Specified by:
executein interfaceIRConnection- Parameters:
rCommands- One or more valid commands in R, separated by\n.- Returns:
- result Result returned from R. Empty if no result was returned.
-
isEngineAvailable
public static boolean isEngineAvailable()
checks if an R engine could be found and the connection is established.- Returns:
trueif the connection is established.
-
assign
public void assign(String name, double[] array)
Description copied from interface:IRConnectionStores an array in a R variable.- Specified by:
assignin interfaceIRConnection- Parameters:
name- Name of the R variable in which the array is stored.array- Array to store in an R variable.
-
-