0 / 0
R scripts
Last updated: Oct 09, 2024
R scripts (SPSS Modeler)

SPSS Modeler supports R scripts.

Syntax allowed

  • In the syntax field of the properties for the various Extension nodes, only statements and functions that are recognized by R are allowed.
  • For the Extension Transform node and the Extension model nugget, data passes through the R script (in batch). For this reason, R scripts for model scoring and process nodes should not include operations that span or combine rows in the data, such as sorting or aggregation. This limitation is imposed to ensure that data can be split up in a Hadoop environment, and during in-database mining. Extension Output and Extension model building nodes do not have this limitation.
  • The addition of a non-batch data transfer mode, in both the Extension Transform node and the Extension model nugget, means that you can either span or combine rows in the data.
  • All R nodes can be seen as independent global R environments. Therefore, using library functions within the two separate R nodes requires the loading of the R library in both R scripts.
  • To display the value of an R object that's defined in your R script, you must include a call to a printing function. For example, to display the value of an R object that's called data, include the following line in your R script:
    print(data)
  • You can't include a call to the R setwd function in your R script because this function is used by SPSS Modeler to control the file path of the R scripts output file.
  • Flow parameters that are defined for use in CLEM expressions and scripting are not recognized if used in R scripts.
  • SPSS Modeler doesn't support the interactive plot in R

Tips

You can run the following R scripts from an Extension Output node:

  • To view information about the distribution of R included with SPSS Modeler:
    R.version
  • To list all installed R packages:
    installed.packages()
Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more