RouteOutput(x, name, description)
x – a data frame, matrix, array, number, or a string
name – character vector containing name (in Statistica) for the object being routed
description – character vector containing a description for the object being routed SpreadsheetName, SpreadsheetHeader – literal string, e.g. “A Frequency Table”
This extension transfers various types of data from the R environment into Statistica Spreadsheets.
Although the function was introduced to retrieve tabular data (such as data frames, matrices, or arrays) into spreadsheets, single-value data such as numbers or strings can be passed as well and will be placed in single-cell spreadsheets. x can be an R variable or a literal value.
The name of this extension, RouteOutput(), hints at the similarity of its behavior to the equivalent Statistica Visual Basic function: the “results” spreadsheets recreated by the function in the Statistica environment become the standard output of the R script / analysis and follow Output Manager settings (in Statistica, select the Tools tab, click Options, and select the Analyses/Graphs: Output Manager tab), i.e., they are “routed” either to individual windows or to a workbook (or multiple workbooks for each analysis, with optional output reports, e.g., as a Microsoft Word document); the most popular setting is a single results workbook.
Optional parameters name and description specify the name and header of the resulting spreadsheet. It is recommended to provide a value for the spreadsheet name for visual distinction in the tree view of the results workbook.
Note that R plots transferred into Statistica as native graphs do not require explicit output routing – all plots generated during a script run are automatically transferred and routed according to Output Manager settings.
Important: Many functions in R, specifically the ones that perform statistical modeling, represent their results as structured objects, sometimes of significant complexity. These objects cannot be reduced to a single table, and therefore cannot be handled by the RouteOutput() extension (they could be automatically traversed in search of tabular components, but since the object structures are specific to a particular method, such an approach would generate a significant amount of “junk” output). However, since the results (the actual data of interest) are either stored in such objects as tabular components or produced by applying an object’s method to some input data, this limitation does not pose any problems – particular results can be easily extracted from such a statistical model object and routed back to Statistica.
Example:
# build a statistical model (Dose Response Curves) model <- multdrc(SLOPE ~ DOSE, CURVE, data = PestSci) … str(model) # display the complex structure of this model/results in R console … # transfer results to Statistica RouteOutput(coefficients(summary(model)), "Summary", "Parameter Estimates") RouteOutput(residuals(model), name = "Residuals", header = "Some Header") RouteOutput(anova(model), "ANOVA") # inherits the default heading from data frame RouteOutput(logLik(model), "Log-Likelihood") RouteOutput(ED(model, c(10, 50, 90)), "Relative Effective Doses (10%/50%/90%)") |
The results for this example may look like this:

