2

I have written two Data Functions in Spotfire as R script Type. One Data Function sources the functions from another Data Function, say "FunctionName.R," in R as:

source("C:\\Users\\Username\\FunctionName.R")

However, I need to reference the same FunctionName.R from the other Data Function in the Spotfire library rather than on the C: drive. It should look something like:

source("\\MainLibrary\\SubLibrary\\FunctionName.R")

where "/MainLibrary/SubLibrary/FunctionName.R" is the Path shown in Data Function Properties. But that path did not work with the source command.

How can I source from the Path shown in Data Function Properties from the same library rather than my local drive?

yellowjacket05
  • 149
  • 1
  • 2
  • 12

2 Answers2

4

A quick hack is to first open up the Main Library FunctionName.R file in RStudio, then go to session --> set working directory --> to source file location. Then you'll know the exact file path. Sometimes this is a simple fix.

Essentially, the error you're receiving seems to indicate that either the file you're pointing to does not exist or you are providing source with an incorrect path. Without knowing your OS, R version, etc, the best way is the easiest way. Have a look here for more information.

Kamil
  • 412
  • 4
  • 11
  • Using "source" with a file on your local machine is easy, and I have gotten this to work. The problem here is referencing a file on the server. I have not seen an example where "source" will work with a server path, and TIBCO also did not suggest this is possible. – yellowjacket05 Apr 01 '18 at 19:36
0

One solution that I received from TIBCO is to create a custom package for any functions that should not be included in the main Data Function and import the package into Spotfire.

yellowjacket05
  • 149
  • 1
  • 2
  • 12