RScript functions help and syntax

Aug 1, 2014 at 7:29 PM
Edited Aug 1, 2014 at 7:32 PM
Hello everyone,

I have the metrics installed (and the schema refreshed), and I am able to build metrics and deploy R successfully. But I am not able to find the RScript metrics in the list of functions in Metric Editor. I am hoping to find the standard syntax used for all the variation of the RScript function (esp. RScriptAgg, RScriptsimple) but I cannot find anything on the metrics list or in the documentation here. Could someone please point me to the right direction? Sorry if I am missing something basic here.

Aug 1, 2014 at 8:49 PM
Edited Aug 1, 2014 at 8:49 PM
This is covered in the User Guide on Page 8: "The R script functions are added to the list of Data Mining Functions available when creating metrics, including the functions RScript, RScriptU, RScriptAgg, RScriptAggU, and RScriptSimple."

These functions are stored in the Data Mining Functions folder, which maybe hidden in some interfaces (an exception is the MicroStrategy Developer metric editor). This is to discourage users from trying to build these metrics by hand since that can be a very error prone process. Instead, we provide other easier and more reliable ways to create metrics that implement these advanced analytics since they can have esoteric features that must be configured correctly in order to work properly. The logic at work here is to avoid giving users "enough rope to hang themselves."

For example, we have the Training Metric Wizard for creating metrics that build predictive models, because there's simply too many details for even the most expert user to get right when trying to build those metrics by hand. Similarly, since Predictive Metrics are either created automatically during report execution or via PMML Import, there's no need for users to build these by hand either.

The case with the RScript functions is similar and predicated on the fact that you must first have an R Script with the analytic's signature captured in the header block at the top of the R script before you can attempt to execute that R script from MicroStrategy. That header block includes the metric expressions to be used when creating metrics that execute that particular R script. Thanks to the deployR utility, the right function is automatically selected based on the nature of the variables used by the analytic and other settings you can control with that utility. Since it's important that the metric expression is consistent with the R Script and it's signature, it's always easier and more reliable to get the metric expression from the R script or the deployR utility.

I hope this makes sense. And please let me know if there's something you're trying to do where the current approach is sub-optimal for you.
Aug 8, 2014 at 3:00 PM
Thank you for that thorough response. It makes sense not to show these to every user. I also usually use deployR to get the metric definition, it's a good utility and provides consistent and reliable results, but my inner geek wants to look deeper into these metrics.

I was hoping to get some more detail into the correct syntax and the proper intended use of each of these metric definitions, something like what we have for OLAP functions in the advanced reporting guide.

I understand RScript is for passing values between MSTR and R, and RScriptU is applicable for situations where the data is not to be sorted. I am still not 100% on what the intended use of RScriptAgg and RScriptSimple is.