StackHub Bulletin BoardAdvertise your announcements here!


R Programming Extension
bfitRExtAxon funcs

Registered StackHub users may elect to receive email notifications whenever a new package version is released.

There are 7 watchers.



This function simply tests the R connection by requesting the version of R installed. It is useful in determining whether R is installed and Rserve is running on the server.

Fantom signature:
@Axon static Str rConnectionTest()
rCreateSvmModel(rConnection, data, svmModelName, svmModelEq, wd)

Function used to create and save an SVM Model. Warning If a large SVM model is being created, the process could take awhile to run. Best to run this function as a job from SkySpark.


  • rConnection - Used if there are further R commands for manipulating data. Can be null if no commands are needed.
  • data - The training data to use to create the model.
  • svmModelName - The model name.
  • svmModelEq - The model equation.
  • wd - The working directory to save the model to.

Returns a str with the model name and what working directory it was created under.

Fantom signature:
@Axon static Str rCreateSvmModel(RConnection? rConnection, Grid? data, Str svmModelName, Str svmModelEq, Str wd)
rHisKmeans(data, num)

This function takes a grid of historical data, and returns that history with the results of a k-means clustering algorithm. Each datetime entry gets a value corresponding to it's cluster.

Fantom signature:
@Axon static Obj? rHisKmeans(Grid data, Number num)
rLm(data, query)

This function takes in a grid of data, and calculates a linear model matching the query. It returns a grid. The first dict in the grid represents the model (tagged regressionModel), and contains the model data. All following dicts specify individual coefficients with their coefficient name, various statistics, and a regressionCoefficient tag.

The model query is only the model equation portion of the regression command. That is, it doesn't contain lm(, but instead appears like this: v0~v1+v2.

Fantom signature:
@Axon static Grid? rLm(Grid data, Str query)
rQuery(data, query)

Use rq() instead.

This allows the user to run an arbitrary R query on the data passed into it, and returns the resulting object.

data: Optional data to input into the R instance. The input data is passed into R as a data.frame and should be referred to as "data" in the query. The columns of the data may be referenced exactly as they are named in SkySpark (e.g. the "v0" column can be referred to as data$v0 within R).

query: The Rquery to run. Please note that since the query argument is a string, you must escape characters that are not allowed in strings. For example, what would be data$v0 in R, must be entered as data\$v0 in the query.

This function tries to determine the best data object to return, which can range between Lists, Dicts, Grids or individual values depending on what was queried. Column naming is coerced to folio requirements from the R naming. Punctuation is removed, and capitalization will be inserted where spaces or punctuation occurred.

Fantom signature:
@Axon @sys::Deprecated static Obj? rQuery(Grid? data, Str query)
rQueryOutput(data, query)

Use rqExecute(true) instead

This function is exactly the same as rQuery, but returns the printed R output as a string rather than the object representation.

Fantom signature:
@Axon @sys::Deprecated static Str? rQueryOutput(Grid? data, Str query)
rSvmPredict(rConnection, data, svmModelName, wd)

SVM Predict function and return of the prediction value mapped to the original grid provided.


  • RConnection - Provided if other functions are being used to manipulate the data within R.
  • data - the data to be predict on.
  • svmModelName - the name of the model used to predict.
  • wd - the name of the working directory the model lives under.

Returns the predicted value mapped to the grid provided

Fantom signature:
@Axon static Grid rSvmPredict(RConnection? rConnection, Grid data, Str svmModelName, Str wd)

Instatiates an R query, returning the RQuery object

Fantom signature:
@Axon static RQuery rq()
rqEval(rQuery, query)

Inserts the query into the evaluation queue.

  • rQuery: An RQuery object created using rq()
  • query: The string query that should be run in R.
Fantom signature:
@Axon static RQuery rqEval(RQuery rQuery, Str query)
rqExecute(rQuery, strOutput: false)

Inserts the data and executes the queries. Only the last query is returned to Axon.

  • rQuery: An RQuery object created using rq()
  • strOutput: Boolean indicating whether to return an object representation (false) or the string representation that R would return to the console (true).
Fantom signature:
@Axon static Obj? rqExecute(RQuery rQuery, Bool strOutput := false)
rqPassData(rQuery, data, name: "data")

Inserts a SkySpark data grid into R using the provided name. Note that timestamps will be inserted if included in the input grid.

  • rQuery: An RQuery object created using rq()
  • data: A grid of SkySpark data to insert into a dataframe in R
  • name: A string representing the name the dataframe should be assigned in R. This defaults to data
Fantom signature:
@Axon static RQuery rqPassData(RQuery rQuery, Grid data, Str name := "data")
Published by BuildingFit

Products & Services by BuildingFit

Packages by BuildingFit

Commercial packages

Free packages