Off-the-Shelf R Scripts
<script type="text/javascript" charset="utf-8">// <![CDATA[ window.onload = function() { document.getElementById("LearnMoreBtn").onclick = function(){ var overlay = document.getElementById("overlay"); var popup = document.getElementById("popup"); overlay.style.display = "block"; popup.style.display = "block"; }; document.getElementById("CloseBtn").onclick = function(){ var overlay = document.getElementById("overlay"); var popup = document.getElementById("popup"); overlay.style.display = "none"; popup.style.display = "none"; } }; // ]]></script>R Analytic | Description | R Script | Documentation |
Seasonal Forecasting | Forecasts seasonal data using the Linear Regression algorithm | ![]() URL Metric Expression <button id="CloseBtn">ClosePopup</button> Get the URL Metric Expression | ![]() |
ARIMA | Forecasts time series data using the ARIMA algorithm (Auto-Regression Integrated with Moving Average) | ![]() | ![]() ![]() |
Clustering | Clustering using the k-Mediods algorithm | ![]() | ![]() ![]() ![]() |
Naive Bayes | Classification using the Naive Bayes algorithm | ![]() | ![]() |
Neural Network | Classification using Neural Networks | ![]() | ![]() |
Random Forests | Classification using the Random Forests algorithm | ![]() | ![]() |
How to use:
Prerequisites: In addition to MicroStrategy, make sure you have installed R (available fromwww.r-project.org) and the RScripts functions (available from theDownloads tab on this site). More information can be found in the R Integration Pack User Guide, but the key details are included here:
- R and the RScript functions must be installed anywhere calculations are performed by MicroStrategy.
- MicroStrategy Analytics Enterprise:
- Always the Intelligence Server, since this is where jobs execute for users running MicroStrategy Web, MicroStrategy Office, MicroStrategy Mobile and MicroStrategy Developer.
- MicroStrategy Developer, for when R analytics are deployed as Derived Metrics in 3-tier or when connected 2-tier.
- NOTE: For the Intelligence Server and Developer, after installing the RScript functions on those systems, you'll still need to add the functions to each project's schema. So, please be sure to run the Configuration Wizard to add the new functions to each project where R Analytics will be deployed.
- MicroStrategy Analytics Desktop
- NOTE: Running Configuration Wizard is not required for MicroStrategy Analytics Desktop.
- MicroStrategy Cloud customers can contact the MicroStrategy Cloud team for including R in their Clould instances.
- MicroStrategy Analytics Express: The R Integration Pack is currently NOT supported with MicroStrategy Analytics Express.
- MicroStrategy Analytics Enterprise:
- NOTE: The MicroStrategyR Package and it's deployR utility are NOT required to use these scripts, because they already have had their analytic signature captured into the comment block at the top of the R Script. The MicroStrategyR Package and it's deployR utility are only required by R Script developers in order to prepare the R Script for deployment to MicroStrategy. This step has already been done with these Off-the-Shelf R Analytics.
- Download the R Script and place it in the RScripts folder, usually C:\Program Files (x86)\R Integration Pack\RScripts. You should also download the documentation provided for more details about how the script is meant to be used.
- Open the RScript (using any text editor or an R console), find the MicroStrategy Header block at the top of the script and copy the metric expression(s) for the analytic output(s) you wish to deploy to MicroStrategy.
For example, here's the MicroStrategy Header block from the SeasonalForecasting.R script that comes with the R Integration Pack installation. The metric expression for the Forecast output can be found inbold:
#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
- Paste the metric expression into any metric editor
- Replace the inputs to the metric with the appropriate existing metrics in your project.
- Once the metric is validated, you can use it on your report, documents and dashboards, just like any other metric.
Share your scripts:
We'd like to encourage everyone in the community to use and share these R Scripts. Have you written an R Script you'd like to share with the rest of the community? That would be great!
If you have a R Script you'd like to contribute, please email your script and it's documentation torpechter@microstrategy.com. We'll test it to confirm its ready for general use by others. Once accepted, we'll add it to this page.
Code Disclaimer:
This page provides programming examples. MicroStrategy grants you a nonexclusive copyright license to use all programming code examples from which you can use or generate similar function tailored to your own specific needs. All sample code is provided for illustrative purposes only. These examples have not been thoroughly tested under all conditions. MicroStrategy, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. All programs contained herein are provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.