Spotfire® Service for R Installation and Administration

Spotfire SPK versioning

Typically, you create the SPK (.spk) file that contains the packages, and then you install it on a service running on a Spotfire Server node. You might need to change or update the packages that you distribute, which requires updating the .spk file.

You can create or change a Spotfire .spk file using R or from a text editor. The R function buildServerSPK (found in the SpotfireSPK package) creates the Spotfire .spk file using the versioning rule details for the following tasks.
Note: The SPK property BuiltVersion is NOT the same as the package version. That information is stored in the package DESCRIPTION file. BuiltVersion is always specified as four components (N.n.n.n).
Note: Each of the following examples assumes a call to .libPaths, as described in Helper packages included in the service to set the package path.
Task Example Notes and Results

Create a new DCF for a new SPK containing packages to put on the Spotfire Server.

From the R console, install the required packages, and then create the SPK.

#load the library containing 
#the tools
library(SpotfireSPK)

#install the packages to go 
# into the SPK
install.packages(c("plyr","zoo"))

#create the DCF containing 
# the package names
writeLines("Packages: plyr,zoo", "ServerSPK.dcf")

#create the SPK to upload to the 
# Spotfire Server
buildServerSPK("ServerSPK.dcf", "ServerSPK.spk")
A DCF with the name ServerSPK.dcf is created containing the package names listed in the text argument of writeLines, along with their required and dependent packages. The specified packages are included in the SPK.

The SPK BuiltVersion number is listed in the DCF as follows.

"BuiltVersion: 1.0.0.0"
Tip: You can see the BuiltVersion by opening the DCF in a text editor, or by calling readLines:
readLines("ServerSPK.dcf")
Add packages to an existing SPK to put on Spotfire Server. Using a text editor, open the existing DCF, and add names to the list of the (installed) packages to put in the SPK. Do not edit any other part of the DCF.

Packages: plyr,zoo,caret,forecast

From the R console, create the SPK.

#create the SPK to upload to the 
# Spotfire Server
buildServerSPK("ServerSPK.dcf", "ServerSPK.spk", 
spkName = "Official CRAN Packages")
The DCF with the name ServerSPK.dcf is overwritten, and the packages you manually added to the DCF are added to the SPK.
The SPK BuiltVersion is changed to the next minor version number and is listed in the DCF. For example:
"BuiltVersion: 1.1.0.0"
Remove a package from the existing SPK (and subsequently from Spotfire Server). Using a text editor, open the existing DCF, and remove the unwanted package names from the list of packages. Do not edit any other part of the DCF.

Packages: plyr

From the R console, create the SPK.
#create the SPK to upload to the 
# Spotfire Server
buildServerSPK("ServerSPK.dcf", "ServerSPK.spk", 
spkName = "Official CRAN Packages")
The DCF with the name ServerSPK.dcf is overwritten, and only the packages remaining in the DCF are included in the SPK.
The SPK BuiltVersion is changed to the next major version number and listed in the DCF. For example:
"BuiltVersion: 2.0.0.0"
Assign a specific BuiltVersion number to an SPK.

From the R console, install the required packages, and then create the SPK.

#load the library containing 
# the tools
library(SpotfireSPK)

#install the required packages
install.packages(c("plyr","zoo"))

#create the DCF containing 
# the packages
writeLines("Packages: plyr,zoo", "ServerSPK.dcf")

#create the SPK to upload to the 
# Spotfire Server,
#passing in the version number.
#This argument is a character string or a 
#numeric_version object containing four components
buildServerSPK("ServerSPK.dcf", "ServerSPK.spk", version="1.2.3.4")
The DCF with the name ServerSPK.dcf is created (or overwritten if it already existed), and the packages specified in the DCF are included in the SPK.
The SPK BuiltVersion is set to the value passed in for the argument version. For example:
"BuiltVersion: 1.2.3.4"
Generate a new DCF with the same name.

From the R console, install the required packages, and then create the SPK.

#load the library containing 
# the tools
library(SpotfireSPK)

#install the packages to go into 
# the SPK
install.packages(c("forecast","caret"))

#create the DCF containing the 
# names of the installed 
# packages
writeLines("Packages: forecast,caret", "ServerSPK.dcf")

#create the SPK to upload to the 
# Spotfire Server
buildServerSPK("ServerSPK.dcf", "ServerSPK.spk")
Important: If you use this method to overwrite an existing DCF, the version number is still set to 1.0.0.0; therefore, Spotfire Server does not register the package as a new one, so it does not distribute the new packages to the users.
The DCF with the name ServerSPK.dcf is overwritten, and the package names listed in the text argument of writeLines, along with their required and dependent packages, are included. The packages specified are included in the SPK.
The SPK BuiltVersion number is listed in the DCF as follows:
"BuiltVersion: 1.0.0.0"