Search code examples
rspotfire

How to generate correlation values in Spotfire using an R script


I believe there is a way to generate correlation values in Spotfire without writing an R script however I would like to understand why the below code is not running in Spotfire. I also tried loading the stats and base libraries into Spotfire to no avail.

The script is below:

output <- cor(input1, input2)

The error message is below:

TIBCO Enterprise Runtime for R returned an error: 'Error in library(pkg, character.only = TRUE) : there is no package called 'correlation''.


Solution

  • Whats most likely happening is that Tibco has a pre-installed package called correlation that masks the cor() function. Call it from the stats library with:

    stats::cor(input1,input2)