Products | Versions |
---|---|
Spotfire Analyst | All supported versions |
Spotfire Web Player | All supported versions |
Spotfire Enterprise Runtime for R | All supported versions |
If a TIBCO Enterprise Runtime for R (TERR) or open-source R package is not installed and a Spotfire data function's TERR or R script loads it using 'require()', the data function can fail with a 'could not find function...' error instead of 'there is no package called...'
Example:
For example, a data function's script might use the Sort() function from the user-contributed CRAN package named "Rfast". (Note that TERR and R are case sensitive. This means that the package's Sort() function is distinct from the built-in sort() function.)
If the "Rfast" package has not been installed in the TERR or R instance that is running the script,
(A) The following script will make the data function return 'Error: could not find function "Sort"':
#----
require(Rfast)
dfB <- Sort(dfA$scores)
#----
(B) The following script will make the data function return "Error in library(Rfast) : there is no package called 'Rfast'":
#----
library(Rfast)
dfB <- Sort(dfA$scores)
#----
When the package of interest has not been installed, library() throws a fatal error message that the data function will return to Spotfire as an Alert in Spotfire, but require() throws a warning, which will not be shown in the Alert if a fatal error is generated later in the script.
This means that the 'could not find function "Sort"' error message, which is generated by the second line in the script, is the only message that appears in the Alert.