How to export data from Spotfire to use with TERR in RStudio.

How to export data from Spotfire to use with TERR in RStudio.

book

Article ID: KB0072914

calendar_today

Updated On:

Products Versions
Spotfire Enterprise Runtime for R All supported versions
Spotfire Desktop All supported versions

Description

When you execute a data function in Spotfire, the data is exported into TIBCO's Spotfire Binary Data Format (SBDF).  TIBCO Enterprise Runtime for R (TERR) contains a function (in its optional built-in "SpotfireData" package) called importDataFromSBDF(), which will import data from SBDF files.  

The advantage of using this method to transfer the data to an RStudio instance that uses TERR is that it is using the same export method that is used when a data function is called in Spotfire. This will ensure that the data types and column names will match exactly when running a data function in Spotfire.

Issue/Introduction

This article shows how to export data from Spotfire to use with TIBCO Enterprise Runtime for R (TERR) in RStudio. ================================ IMPORTANT NOTE: The method used in this article is only available for use with TIBCO Enterprise Runtime for R. It is _not_ available for use with open-source R. This is true because (by design) TIBCO's proprietary "SpotfireData" package for TERR is not available for use with open-source R. ================================

Environment

All supported environments

Resolution

================================
IMPORTANT NOTE:  The method used in this article is only available for use with TIBCO Enterprise Runtime for R.  It is not available for use with open-source R. This is true because (by design) TIBCO's proprietary "SpotfireData" package for TERR is not available for use with open-source R.
================================

Use the following steps:

In Spotfire:

1) Export the data table to file using the SBDF format by selecting File -> Export -> Data to File -> Data table.
2) Select the data table to export from the drop down list shown.
3) Click OK.
4) Select a location to save to, enter a file name, and set Save as type: to "TIBCO Spotfire Binary Data Format (*.sbdf)" .
5) Click Save.


In RStudio with the TERR engine selected:

1) Run the following code to load the dataset:


     library( SpotfireData )
     myData <- importDataFromSBDF( "C:/path/to/myfile.sbdf" )


The data is now available in RStudio, using the object name "myData".
 
Note:  In this example, "C:/path/to/myfile.sbdf" represents the path and name of the file you selected in step 4 of the Spotfire export steps, above. 

Additional Information

To view the help file in TERR, first load the package using this command:

     library( SpotfireData )

then run the following command:
 

     ?importDataFromSBDF