Interface RContext
-
- All Superinterfaces:
AutoCloseable
,Closeable
public interface RContext extends Closeable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
assign(String var, Object value)
Assigns a value to a variable in R.REXP
eval(String expr)
Parses and evaluates an R expression and returns the result.REXP
get(String var)
Retreives a value from RString[]
names(String var)
Often in R, results have a 'names' attribute, for example the parameter names in an lm() regressionvoid
plot(String expr, String fileName)
Future functionality - Not yet implemented!String
print(String var)
When evaluating an expression in R some output may be printed as a side effect, such as by lm().
-
-
-
Method Detail
-
assign
void assign(String var, Object value)
Assigns a value to a variable in R. The following types can be assigned A value of type REXP would be one obtained from R with aneval
orget
call. A Matrix2D object is the result of a PA query:DatamartContext.executeQuery(net.pricefx.formulaengine.DatamartContext.Query)
- Parameters:
var
- Variable to assign tovalue
- Value(s) to assign
-
eval
REXP eval(String expr)
Parses and evaluates an R expression and returns the result. An expression can be as short as or as long as needed (i.e. a whole script).- Parameters:
expr
- The expression, as string, to evaluate- Returns:
- The resulting expression or null in case of an error
-
get
REXP get(String var)
Retreives a value from R- Parameters:
var
- The variable to retreive the value from- Returns:
- The resulting expression
-
names
String[] names(String var)
Often in R, results have a 'names' attribute, for example the parameter names in an lm() regression- Parameters:
var
- The variable to retreive the names from- Returns:
- The names array, or null if there is no such attribute
-
print
String print(String var)
When evaluating an expression in R some output may be printed as a side effect, such as by lm(). While not structured data, it may be useful to capture this output to show as a calculation result in the UI, or merely for logging purposes.- Parameters:
var
- The variable to print, i.e. where that expression was assigned to- Returns:
- The printed output as a string
-
-