Interface RContext

All Superinterfaces:
AutoCloseable, Closeable

public interface RContext extends Closeable
See Also:
  • Method Summary

    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 R
    Often in R, results have a 'names' attribute, for example the parameter names in an lm() regression
    void
    plot(String expr, String fileName)
    Future functionality - Not yet implemented!
    When evaluating an expression in R some output may be printed as a side effect, such as by lm().

    Methods inherited from interface Closeable

    close
  • Method Details

    • 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 an eval or get call. A Matrix2D object is the result of a PA query: DatamartContext.executeQuery(net.pricefx.formulaengine.DatamartContext.Query)
      Parameters:
      var - Variable to assign to
      value - Value(s) to assign
      See Also:
    • 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 (see REXP)
      See Also:
    • get

      REXP get(String var)
      Retreives a value from R
      Parameters:
      var - The variable to retreive the value from
      Returns:
      The resulting expression (see REXP)
      See Also:
    • 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
    • plot

      void plot(String expr, String fileName)
      Future functionality - Not yet implemented!
      Parameters:
      expr -
      fileName -