How to Install R Packages for use with TIBCO Spotfire Analyst Client.

How to Install R Packages for use with TIBCO Spotfire Analyst Client.

book

Article ID: KB0080665

calendar_today

Updated On:

Products Versions
Spotfire Analyst All Versions

Description

This document describes the steps required to install an R package from the Comprehensive R Archive Network (CRAN) onto TIBCO Enterprise Runtime for R (TERR) for use with TERR Data Functions and/or TERR Expression Functions in TIBCO Spotfire 6.5. This is applicable to other versions of TIBCO Spotfire, but the TERR version and TERR references will differ.

An R package is a set of functionality for R or TERR that may not be included in the base installations of R or TERR. You may need to install R packages in order to create or use Spotfire analyses that include TERR Data Functions and/or TERR Expression Functions.

The main repository for R packages that have been contributed by members of the R community is the Comprehensive R Archive Network (CRAN) at http://cran.r-project.org/. The packages on CRAN have been designed to work with open source R, and many also work with TERR. Note that some of the R packages on CRAN do not work with TERR. Documentation about TERR’s compatibility with R packages from CRAN, including compatibility testing results, is available at https://docs.tibco.com/products/tibco-enterprise-runtime-for-r. Even if a package is listed as a test failure in the above documentation, we encourage users to try the package.

This document describes a self-service way for an individual end user of TIBCO Spotfire Analyst or TIBCO Spotfire Desktop software to install R packages on TERR for use with Spotfire on his or her own computer. Be aware that different methods can be used by systems administrators to install R packages on TIBCO Spotfire Statistics Services (TSSS) servers, to enable usage of R packages from TIBCO Spotfire Web Player and to deploy sets of R packages to installations of TIBCO Spotfire Analyst across an organization. For details on these methods, refer to the TIBCO Spotfire Statistics Services Package Management documentation at https://docs.tibco.com/pub/sf_statsvcs/7.0.0/doc/pdf/TIB_sf_statsvcs_7.0.0_Package_Management.pdf and/or https://docs.tibco.com/products/tibco-spotfire-statistics-services.
 

Issue/Introduction

How to Install R Packages for use with TIBCO Spotfire Analyst Client.

Resolution

In Spotfire version 7.5 and higher:

Follow the "How to Use TERR Tools" instructions from the client help:

1) From the menu, click Tools > TERR Tools.

2) Click the Package Management tab.

3) If you are working through a proxy, click the check box Use IE Proxy Settings.

4) Click the drop-down arrow for the CRAN Package Repository list, select the repository site mirror to use, and then click Load. The CRAN packages available at the location you selected are displayed in the Available Packages selection box.

5) Scroll through the list to locate the package you need. Alternatively, for a specific package, type its name in the Available Packages box. 

6) Click Install to install the selected package(s).
 

In Spotfire version 7.0 and lower:

1). Find the link that you use to open Spotfire 6.5, right click on it, and click Properties.
a).  If you are using the link in the Windows Taskbar, you will have to right click a second time on Spotfire 6.5.0, then click Properties.
2).  In Properties, click the “Open File Location” button. This will bring you to the folder where Spotfire is installed.
 
3).  In the folder where Spotfire is installed, open the Modules sub-folder.
a).  The Modules sub-folder is a hidden folder. If you cannot see the Modules folder, then type \Modules at the end of the path in the address bar, then press Enter to enter the Modules sub-folder.
b).  Alternately, to show the Modules folder, you can adjust your computer’s settings so that hidden files, folders and drives are shown. Instructions for how to do this are available at http://windows.microsoft.com/en-us/windows/show-hidden- files#show-hidden-files=windows-7.
c).  If you still cannot see or enter the Modules sub-folder, then skip to the step below beginning, “If you are not an Administrator user”.
4).  In the Modules sub-folder, open the sub-folder whose name begins with “TIBCO Enterprise Runtime for R” and ends with a version number.
a).  If there is more than one folder beginning like this, then open the one with the highest version number.
5).  If you are not an Administrator user on your computer, the newest Modules folder may be in a different location and not in the folder where Spotfire is installed. Navigate to C:\Users\username\AppData\Local\TIBCO\Spotfire\version\Modules, substituting your Windows username for username and choosing the highest number version folder present. Note that version folder may not be named 6.5.0—if you originally installed an older version of Spotfire and later updated it to 6.5.0. Then version may be an older version number. If you locate two Modules folders, then browse both of them and find the sub-folder whose name begins with “TIBCO Enterprise Runtime for R” and ends with the highest version number. Open that folder.

6).  In the sub-folder whose name begins with “TIBCO Enterprise Runtime for R” and that has the highest version number, open the engine sub-folder.

7).  Open the bin sub-folder.

8).  Double-click TERR.exe. This opens the TERR command console.
a).  If you are not an Administrator user on your computer, you may need to right click TERR.exe and click Run as Administrator.
9).  In the TERR command console, enter the command:
install.packages("name-of-package")
substituting the actual name of the package for name-of-package.
a).  Be sure to include the quotation marks around the name of your package.
b).  Package names are case-sensitive.
10). You should be prompted with a list of CRAN mirrors. These are web servers throughout the world that host CRAN packages. Choose one that is physically proximate to you and enter the number appearing before it at the “Selection:” prompt. Press Enter.
 
a).  If you are never prompted with a list of CRAN mirrors, then close the TERR command console by clicking the X button on the upper right, then re -open it and first enter the command:
setInternet2()
Then enter the install.packages command as described above. This often resolves Internet connectivity issues on networks with proxy servers.
11). It may take several minutes to install the package and any other packages that are its dependencies. You should see one or more “Downloaded” and “installing” messages print to the TERR console. When the process has finished, you should see the “ >” prompt and the messages printed should not show any errors.
a).  If error messages were printed, then close the TERR command console byclicking the X button on the upper right, then re -open it and repeat the process, choosing a different CRAN mirror.
12). When the package installation process has successfully completed, enter the command:
library(name-of-package)
in the TERR command console, substituting the actual name of the package for name- of-package.
a).  You may see one or more warnings printed to the console. Warnings during package load are often not a problem and can often be disregarded. To suppress these package load warnings and other messages, you can use the command:
suppressWarnings(
   suppressPackageStartupMessages(
      library(name-of-package)
   )
)
substituting the actual name of the package for name-of-package.
b).  You should not see any errors printed to the console. If you see errors, then it may be that the R package you have installed does not work with TERR. Documentation about TERR’s compatibility with R packages from CRAN, including compatibility testing results, is available at https://docs.tibco.com/pub/enterprise-runtime-for- R/2.5.0/doc/pdf/TIB_TERR_2.5.0_R_Compatibility.pdf . Workarounds are available to enable usage of open source R in cases where a package does not work with TERR. Contact TIBCO Spotfire Support for assistance.
13). Once you have successfully installed an R package by following the above steps, you can create or use Spotfire analyses that include TERR Data Functions and/or TERR Expression Functions that require the R package.

Additional Information

How to Use TERR Tools:
 - https://docs.tibco.com/pub/sfire-analyst/7.5.1/doc/html/WebHelp/terr/terr_how_to_use_terr_tools.htm

How to Install R Packages for Use with TIBCO Spotfire 6.5
 - http://admin.viewcentral.com/events/uploads/TIBCO/Install-R-Packages_v65.pdf