ScriptFunctionDefinition
Manipulate Spotfire Script Function Definition Files

Description

Use these functions to create TIBCO Enterprise Runtime for R objects manually, to import into these objects Spotfire Script Function Definition (.sfd) files, or to export TIBCO Enterprise Runtime for R objects into Script Function Definition files for use with Spotfire.

Usage

importScriptFunctionDefinition(filename)
exportScriptFunctionDefinition(def, filename = NULL)

createScriptFunctionDefinition(name, script, language = "TERR", packages = character(0), inputs = list(), outputs = list(), description = character(0), allow.caching = TRUE, version.major = 1, version.minor = 0) createScriptFunctionInput(name, type, display.name = character(0), description = character(0), optional = FALSE, data.types = character(0)) createScriptFunctionOutput(name, type, display.name = character(0), description = character(0))

## S3 method for class 'SpotfireScriptFunctionDefinition': print(x, ...) ## S3 method for class 'SpotfireScriptFunctionInput': print(x, ...) ## S3 method for class 'SpotfireScriptFunctionOutput': print(x, ...)

Arguments

filename a character vector containing the filename of the Script Function Definition file to import or export. In exportScriptFunctionDefinition, if NULL, the filename is formed by concatenating the name of the function definition and the suffix ".sfd".
def a SpotfireScriptFunctionDefinition object to export as a Script Function Definition file.
name a character string containing the name of the function definition, input, or output to create.
script a character vector or connection containing the text of the script to run in the function definition.
language a character string containing the statistical engine in which to run this function definition. For Script Function Definition schema version 1.0, this should be one of "SPlus", "R", "TERR", "MATLAB", or "SAS".
packages a character vector containing the names of S-PLUS, R, or TIBCO Enterprise Runtime for R packages required by the function definition.
inputs a list of SpotfireScriptFunctionInput objects describing the input parameters to the function definition.
outputs a list of SpotfireScriptFunctionOutput objects describing the output parameters to the function definition.
description a character string containing a textual description of the function definition, input, or output to create.
allow.caching a logical value. If TRUE (the default), allow the Spotfire client to cache the results of running this function definition.
version.major an integer value indicating the major version of the Script Function Definition schema this function definition adheres to.
version.minor an integer value indicating the minor version of the Script Function Definition schema this function definition adheres to.
type a character string containing the type of the input or output. For Script Function Definition schema version 1.0, this should be one of "Value", "Column", or "Table".
display.name a character string containing the input or output name displayed to users of the function definition.
optional a logical value. If TRUE, requires that the input is specified when this function definition is inserted into a Spotfire analysis. The default is FALSE.
data.types a character vector containing the allowed Spotfire data types for this input. For Script Function Definition schema version 1.0, this can be one of "String", "Bool", "Integer", "Decimal", "Date", "Time", "DateTime", "TimeSpan", "Long", "Float", "Double", or "Binary".
x a SpotfireScriptFunctionDefinition, SpotfireScriptFunctionInput, or SpotfireScriptFunctionOutput object to be printed.
... additional arguments to pass to the print method. Ignored.
Value
importScriptFunctionDefinition and createScriptFunctionDefinitionreturn a list of the S3 class SpotfireScriptFunctionDefinition that represents the function definition from the Script Function Definition file or the arguments to the function, respectively. The list contains the names version.major, version.minor, name, script, language, packages, inputs, outputs, description, and allow.caching. (All having the same meaning as the arguments to the createScriptFunctionDefinition function.)
createScriptFunctionInputreturns a list of the S3 class SpotfireScriptFunctionInput that represents the input parameter. The list contains the names name, type, display.name, description, optional, and data.types. (All having the same meaning as the arguments to the createScriptFunctionInput function.)
createScriptFunctionOutputreturns a list of the S3 class SpotfireScriptFunctionOutput that represents the output parameter. The list contains the names name, type, display.name, and description. (All having the same meaning as the arguments to the createScriptFunctionOutput function.)
exportScriptFunctionDefinitionreturns NULL invisibly.
Examples
## Not run: 
# Convert an R data function into a TERR data function
d <- importScriptFunctionDefinition("RDataFunction.sfd")
d$language <- "TERR"
exportScriptFunctionDefinition(d, "TERRDataFunction.sfd")

# Manually create a data function d.out <- list(createScriptFunctionOutput(name="x", type="column", display.name="Values")) d <- createScriptFunctionDefinition(name="Manual", script="x <- 1:10", outputs=d.out, description="A manually created script function definition.") exportScriptFunctionDefinition(d) # Creates "Manual.sfd"

# Create a data function from a script file on disk tmpscript <- tempfile() writeLines("x <- 1:10", tmpscript) d <- createScriptFunctionDefinition(name="From Disk", script=readLines(tmpscript), outputs=d.out, description="A script function definition whose script came from a file.") exportScriptFunctionDefinition(d, "FromDisk.sfd") ## End(Not run)

Package SpotfireUtils version 6.0.0-69
Package Index