Creating the Spotfire SPK

Practice building an SPK that contains only one package: the survival package downloaded from the Comprehensive R Archive Network (CRAN).

Prerequisites

You must have access to the TERR engine, either through your Spotfire installation, or the stand-alone TERR console.

Note: The survival R package is compatible with TERR; however, note that some of its examples might use the plot function, which is not supported in version 4.3.

When you prepare an SPK to be deployed to the Spotfire Server, remember the following rules:

  • The Spotfire SPK can contain as many R packages as you need.
  • Only one Spotfire SPK is allowed in a deployment area on the server; if you redeploy it, it overwrites your previously-deployed SPK.
  • To distribute an updated Spotfire SPK to the Spotfire Analyst installations using the server, the Spotfire SPK must have its BuiltVersion incremented.

This example walks you through installing a package, generating the list, Install your package and make sure it works.

Procedure

  1. Load the Spotfire SPK package. library(SpotfireSPK)
  2. Install a package to be in your Spotfire SPK file. install.packages("survival")
    The package survival is downloaded from the CRAN repository.
  3. Generate the Debian Control File (DCF).
    The DCF contains the package list to build into the Spotfire SPK.
    writeLines("Packages: survival", "SpotfireSPK.dcf")
    Important: See Spotfire SPK versioning for information about creating the DCF and versioning the SPK.
  4. Build the SPK.
    Note: In this example, you are building the SPK without passing any arguments for certificates or passwords, and the resulting output specifies that your resulting SPK is unsigned. If you do not include the arguments certificate and password in your buildSPK function, when the package is distributed, Spotfire Analyst users see a message warning of an unsigned file, and they are prompted to accept or reject the installation. This message appears for every update of the unsigned package. See your server administrator for a certificate and password to include.

    buildSPK("SpotfireSPK.dcf", "SpotfireSPK.spk")

    Note that "SpotfireSPK.spk" is not signed.
building SpotfireSPK.spk.
Done.
  5. Print the new list file.

    cat(readLines("SpotfireSPK.dcf"), sep="\n")

    Packages: survival
    Built: TERR 4.3.0; (includes date and time)
    BuiltName: TIBCO Enterprise Runtime for R Packages
    BuiltId: F13B9A7E-783A-432a-8676-42FCD3022D70
    BuiltVersion: 1.0.0.0
    BuiltPackages: survival (>=2.38-3)
    

    (Your output will vary.)

  6. Browse your computer for the SPK file and the DCF file.

    By default, both of these files are written to the your Users\user name directory.

    Remember that you can have only one SpotfireSPK package deployed to your Spotfire Server, and you can use the DCF list to keep track of the packages in the SPK. We recommend you keep this list where you can update it as necessary. See Packages deployed for a small group for more information.