MicroStrategy ONE
The R Integration Pack is no longer supported as of December 2024.
Using MicroStrategy names for R variables
The R Integration Pack passes data from MicroStrategy into R for execution by mapping MicroStrategy metrics to R variables. 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.
The names of the metrics in MicroStrategy may not always match the names of the variables in R. For R analytics, R variables typically have generic names, as is the case with the R script example used in this section: Target, Trend, and Season.
To forecast monthly revenue, the corresponding MicroStrategy metrics could be Revenue, Month Index, and Month of Year.
To provide this support, each R script function has an _InputNames function parameter to allow you to pass MicroStrategy names to R. When you create a metric to display the results of your R analytics in the MicroStrategy Metric Editor, you can define the _InputNames function. You can use the metric expression generated for your R analytics to retrieve the inputs for your R script. The inputs are located at the end of the metric expression between the final parentheses "(...)". You can then replace each input name with the associated MicroStrategy metric that provides its data, and copy the inputs to the _InputNames function parameter.
For this example, the metric expression would be:
RScript(Revenue, [Month Index], [Month of Year])
Copy the metric names (between the parentheses) and paste them into the _InputNames function parameter to define the R script's metric parameter as Revenue, [Month Index], [Month of Year]. An example using MicroStrategy Developer's Metric Editor is shown below: