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 void
assign(String name, double[] array)
Stores an array in a R variable.void
assign(String name, int[] array)
Stores an array in a R variable.void
assign(String name, String[] array)
Stores an array in a R variable.void
checkPackageAvailability(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 RRegressionConnection
getRRegressionConnection()
protected void
initalizeConnection()
Initializes the connection to a R engine.static boolean
isEngineAvailable()
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:RRegressionConnection
Stores an array in a R variable.- Specified by:
assign
in 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:RRegressionConnection
Stores an array in a R variable.- Specified by:
assign
in 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:
checkPackageAvailability
in 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:IRConnection
Executes the command(s) in R.- Specified by:
execute
in 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:
true
if the connection is established.
-
assign
public void assign(String name, double[] array)
Description copied from interface:IRConnection
Stores an array in a R variable.- Specified by:
assign
in interfaceIRConnection
- Parameters:
name
- Name of the R variable in which the array is stored.array
- Array to store in an R variable.
-
-