MicroStrategy ONE
The R Integration Pack is no longer supported as of December 2024.
Retrieving R Script Metric Expressions
Once an R script that includes statistical analysis has been processed using the MicroStrategy deployR utility, it is ready to be integrated into your MicroStrategy environment.
Creating R scripts using R and processing them using the deployR utility is described in Developing Custom R Scripts.
To integrate the statistical analysis, you must retrieve the metric expression. You can open the .R file using a text editor. Within the file, search for the line that begins with one of the available R script functions, which includes RScript, RScriptU, RScriptAgg, RScriptAggU, and RScriptSimple.
For example, the SeasonalForecasting.R file included with the R Integration Pack includes the following metric expression:
RScript<_RScriptFile="SeasonalForecasting.R", _ InputNames="Target, Trend, Season", StringParam9=""> (Target, Trend, Season)
In addition to the SeasonalForecasting.R file included with the R Integration Pack, MicroStrategy provides example R script files that can be downloaded from the MicroStrategy GitHub site. The metric expressions include comments which need to be removed manually using a text editor, or the example scripts can be processed using the deployR utility.
This metric expression can then be used to help make the R script available and finally begin to perform statistical analysis in MicroStrategy by creating a metric.