MicroStrategy ONE
The R Integration Pack is no longer supported as of December 2024.
Modifying R Analytics Deployment Example
Below is the R script for the forecasting analytic described inn Combining All Techniques for a Robust Script . It is also available as part of the installation package in the default RScripts folder as a file called SeasonalForecasting.R.
The header block for this R script is as follows:
Copy
# MICROSTRATEGY_BEGIN
#
# RVAR target -input -numeric -vector
# RVAR trend -input -numeric -vector
# RVAR Season -input -vector
#
# RVAR FileName -parameter StringParam9
#
# RVAR Forecast -output -numeric -vector # Metric Expression:
RScript<_RScriptFile="SeasonalForecasting.R",_InputNames="Target, Trend, Season", StringParam9=""> (Target, Trend, Season)
#
# MICROSTRATEGY_END
This header includes the following features:
- Lines that begin with # are comments and are ignored by R.
- MicroStrategy processes the contents between the # MICROSTRATEGY_BEGIN and # MICROSTRATEGY_END lines to understand the script's signature. You should not edit this block manually because doing so can cause errors.
- If you modify the R script or want to change anything else, open the R script using the deployR utility. The deployR utility automatically restores everything in the header, as well as looks for any new variables in the script. You can then use the deployR utility to make adjustments. Saving any changes replaces the existing header block with an updated one, and provides the updated metric expression as well.
The metric expression, highlighted with bold text above, is included in this header block and is ready to copy and paste into a metric definition.