MicroStrategy ONE
Functions for R Integration
The R Integration Pack is no longer supported as of December 2024.
MicroStrategy supports the integration and deployment of analytics from the R statistical environment to MicroStrategy Web or Workstation. Customers interested in deploying analytics from the R programming language into MicroStrategy can do so using the R Integration Pack, available on the MicroStrategy GitHub site.
The third-party R environment is freely available, as a separate download, from CRAN-R.
Once you have downloaded and configured the R Integration Pack, there are several functions available in MicroStrategy Web or Workstation that allow you to deploy your R analytics. These functions include:
For the functions listed below, scalars are variables with a single value while vectors are variables with one or more values.
- RScript: Supports R scripts that use vectors for the inputs and output. Sorting is also supported.
- RScriptAgg: Supports R scripts that use vectors for the inputs and a scalar output. Sorting is also supported.
- RScriptAggU: Supports R scripts that use vectors for the inputs and a scalar output. This is a version of the
RScriptAgg
function that does not include sorting. - RScriptSimple: Supports R scripts that use scalar for the inputs and output. Sorting is not supported.
- RScriptU: Supports R scripts that use vectors for the inputs and output. This is a version of the
RScript
function that does not include sorting.
The easiest way to create a metric expression that utilizes these functions
A metric expression that can then be used in a derived metric to include the statistical analysis of an R script in a MicroStrategy Web or Workstation dashboard. The R Integration Pack User Guide provides steps to use the deployR utility to create metric expressions for R scripts.
When defining these functions in MicroStrategy Web or Workstation, you have the following options:
Value1, ..., Value
N
: The MicroStrategy metrics that act as inputs for the R script.BooleanParam1, ..., BooleanParam9
: A set of boolean parameters that allow you to pass boolean values into R scalar values that do not change from execution to execution. If you use any boolean parameters in your R script, you can define the default value for the parameter when using the function in MicroStrategy Web or Workstation.NumericParam1, ..., NumericParam9
: A set of numeric parameters that allow you to pass numeric values into R scalar values that do not change from execution to execution. If you use any numeric parameters in your R script, you can define the default value for the parameter when using the function in MicroStrategy Web or Workstation.StringParam1, ..., StringParam9
: A set of string parameters that allow you to pass string values into R scalar values that do not change from execution to execution. If you use any string parameters in your R script, you can define the default value for the parameter when using the function in MicroStrategy Web or Workstation._WorkingDir
: The R scripts working directory, which is used to store various supporting files._OutputVar
: The R variable that is used as the output for the metric. If there is more than one output, the first output is considered the default output unless otherwise specified here._NullsAllowed
: Controls whether records containing null values are to be passed in as inputs to your analytic:- True (default): Null values are included in the analysis.
- False: All records containing null values are eliminated from the analysis.
_CheckInputCount
: Controls whether MicroStrategy ensures that the number of inputs to the metric exactly matches exactly the number of inputs specified in the function's signature:- True (default): If the number of inputs is different, a warning message is returned when using the R script in MicroStrategy.
- False: If the number of inputs is different, the script execution will attempt to proceed.
_RScriptFile
: The directory where the R script file is stored._InputNames
: The MicroStrategy metric names that are used as inputs to the R script. For the R environment to be able to use the MicroStrategy metric names in objects and graphics that R generates, the names associated with the inputs from MicroStrategy need to be passed to R._Params
: For internal use only.BreakBy
: The logical level where the calculation of values for an expression restarts. You can select the break by attribute from the drop-down list.SortBy
: Controls the sorting of records before the data is passed to R. To specify a particular sorting criterion, you can select the sort by value from the drop-down list. Use the button to the right of the drop-down list to define whether the sort is ascending or descending.