public abstract class AbstractRClient extends Object implements RClient
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
Constructor and Description |
---|
AbstractRClient() |
Modifier and Type | Method and Description |
---|---|
String |
assignFactor(List<String> strings) |
String |
assignFactor(String factorName,
List<String> list) |
String |
assignMatrix(double[][] matrix)
Assign a 2-d matrix.
|
String |
assignMatrix(DoubleMatrix<?,?> matrix)
Assign a 2-d matrix.
|
String |
assignMatrix(DoubleMatrix<?,?> matrix,
org.apache.commons.collections4.Transformer rowNameExtractor)
Assign a 2-d matrix.
|
String |
assignStringList(List<?> strings)
Define a variable corresponding to a character array in the R context, given a List of Strings.
|
boolean |
booleanDoubleArrayEval(String command,
String argName,
double[] arg)
Run a command that takes a double array as an argument and returns a boolean.
|
String |
dataFrame(ObjectMatrix<String,String,Object> matrix)
Convert an object matrix into an R data frame.
|
ObjectMatrix<String,String,Object> |
dataFrameEval(String command)
Evaluate a command that returns a dataFrame
|
abstract void |
disconnect() |
double[] |
doubleArrayDoubleArrayEval(String command,
String argName,
double[] arg)
Run a command that has a single double array parameter, and returns a double array.
|
double[] |
doubleArrayEval(String command)
Run a command that returns a double array with no arguments.
|
double[] |
doubleArrayTwoDoubleArrayEval(String command,
String argName,
double[] arg,
String argName2,
double[] arg2)
Run a command that takes two double array arguments and returns a double array.
|
double |
doubleTwoDoubleArrayEval(String command,
String argName,
double[] arg,
String argName2,
double[] arg2)
Run a command that takes two double arrays as arguments and returns a double value.
|
int[] |
intArrayEval(String command) |
LinearModelSummary |
linearModel(double[] data,
Map<String,List<?>> factors)
Lower level access to linear model.
|
LinearModelSummary |
linearModel(double[] data,
ObjectMatrix<String,String,Object> d) |
List<?> |
listEval(Class<?> listEntryType,
String command)
FIXME only partly implemented, possibly not going to stay.
|
boolean |
loadLibrary(String libraryName) |
protected void |
loadScript(InputStream is)
There is a pretty annoying limitation of this.
|
OneWayAnovaResult |
oneWayAnova(double[] data,
List<String> factor)
Lower-level access to a simple one-way ANOVA
|
Map<String,OneWayAnovaResult> |
oneWayAnovaEval(String command) |
void |
remove(String variableName)
Remove a variable from the R namespace
|
Map<String,LinearModelSummary> |
rowApplyLinearModel(String dataMatrixVarName,
String modelFormula,
String[] factorNames)
Run lm with anova on all the rows of a matrix
|
String |
stringEval(String command)
Evaluate any command and return a string
|
List<String> |
stringListEval(String command) |
TwoWayAnovaResult |
twoWayAnova(double[] data,
List<String> factor1,
List<String> factor2,
boolean includeInteraction)
Lower-level access to two-way ANOVA
|
Map<String,TwoWayAnovaResult> |
twoWayAnovaEval(String command,
boolean withInteractions)
Evaluates two way anova commands of the form
apply(matrix,1,function(x){anova(aov(x~farea+ftreat))}
and
apply(matrix,1,function(x){anova(aov(x~farea+ftreat+farea*ftreat))}
where farea and ftreat have already been transposed and had factor called on them.
|
static String |
variableIdentityNumber(Object ob) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
assign, assign, assign, assign, eval, getLastError, isConnected, retrieveMatrix, voidEval
public static String variableIdentityNumber(Object ob)
ob
- public String assignFactor(List<String> strings)
assignFactor
in interface RClient
public String assignFactor(String factorName, List<String> list)
assignFactor
in interface RClient
public String assignMatrix(double[][] matrix)
RClient
assignMatrix
in interface RClient
public String assignMatrix(DoubleMatrix<?,?> matrix)
RClient
assignMatrix
in interface RClient
public String assignMatrix(DoubleMatrix<?,?> matrix, org.apache.commons.collections4.Transformer rowNameExtractor)
RClient
assignMatrix
in interface RClient
public String assignStringList(List<?> strings)
RClient
assignStringList
in interface RClient
public boolean booleanDoubleArrayEval(String command, String argName, double[] arg)
RClient
booleanDoubleArrayEval
in interface RClient
public String dataFrame(ObjectMatrix<String,String,Object> matrix)
RClient
public ObjectMatrix<String,String,Object> dataFrameEval(String command)
RClient
dataFrameEval
in interface RClient
public abstract void disconnect()
public double[] doubleArrayDoubleArrayEval(String command, String argName, double[] arg)
RClient
doubleArrayDoubleArrayEval
in interface RClient
public double[] doubleArrayEval(String command)
RClient
doubleArrayEval
in interface RClient
public double[] doubleArrayTwoDoubleArrayEval(String command, String argName, double[] arg, String argName2, double[] arg2)
RClient
doubleArrayTwoDoubleArrayEval
in interface RClient
public double doubleTwoDoubleArrayEval(String command, String argName, double[] arg, String argName2, double[] arg2)
RClient
doubleTwoDoubleArrayEval
in interface RClient
public int[] intArrayEval(String command)
intArrayEval
in interface RClient
public LinearModelSummary linearModel(double[] data, Map<String,List<?>> factors)
RClient
linearModel
in interface RClient
factors
- Map of factorNames to factors (which can be expressed as Strings or Doubles). If you care about
the order the factors are introduced into the model, use a LinkedHashMap.public LinearModelSummary linearModel(double[] data, ObjectMatrix<String,String,Object> d)
linearModel
in interface RClient
d
- which will be converted to factors or continuous covariates depending on whether the columns are
booleans, strings or numerical. Names of factors are the column names of the design matrix, and the rows
are assumed to be in the same order as the data.public List<?> listEval(Class<?> listEntryType, String command)
public boolean loadLibrary(String libraryName)
loadLibrary
in interface RClient
public OneWayAnovaResult oneWayAnova(double[] data, List<String> factor)
RClient
oneWayAnova
in interface RClient
public Map<String,OneWayAnovaResult> oneWayAnovaEval(String command)
oneWayAnovaEval
in interface RClient
public void remove(String variableName)
RClient
public Map<String,LinearModelSummary> rowApplyLinearModel(String dataMatrixVarName, String modelFormula, String[] factorNames)
RClient
rowApplyLinearModel
in interface RClient
dataMatrixVarName
- from an assignment of a matrixmodelFormula
- and other options that will be passed as the argument to 'lm(...)', that refers to factor
variables that have already been assigned, using x as the outcome. Example might be x ~ f1 + f2.public String stringEval(String command)
RClient
stringEval
in interface RClient
public List<String> stringListEval(String command)
stringListEval
in interface RClient
public TwoWayAnovaResult twoWayAnova(double[] data, List<String> factor1, List<String> factor2, boolean includeInteraction)
RClient
twoWayAnova
in interface RClient
public Map<String,TwoWayAnovaResult> twoWayAnovaEval(String command, boolean withInteractions)
RClient
apply(matrix,1,function(x){anova(aov(x~farea+ftreat))}
andapply(matrix,1,function(x){anova(aov(x~farea+ftreat+farea*ftreat))}
where farea and ftreat have already been transposed and had factor called on them.twoWayAnovaEval
in interface RClient
protected void loadScript(InputStream is)
is
- Copyright © 2003–2023 UBC Michael Smith Laboratories. All rights reserved.