MicroStrategy ONE

The R Integration Pack is no longer supported as of December 2024.

Logging Warning Messages and Errors from R

Warning messages related to R code inform users of potential issues that may be important, but are not severe enough to halt execution of the statistical analysis.

You can define your R scripts that are executed by MicroStrategy to log all warning messages to a log file. This provides a way to review warning messages from R that occurred when the R script was executed by MicroStrategy.

The following code can be added to the beginning of the try block of your R script to include both warning and error messages from R to the RscriptErrors.log file:

Copy
warning_file = file("RScriptErrors.log", open = "wt")
sink(warning_file, type = "message")

At the end of the try block of your R script, and before the line mstr.ErrMsg <-"", add the following line of code:

Copy
sink(type = "message")

At the beginning of the error block, add the following line of code:

Copy
sink(type = "message")

When the R script is executed by MicroStrategy, warning messages and errors from R are logged to RScripErrors.log for review.