exportDataToSBDF
Export Data to an SBDF File

Description

Exports data to Spotfire's proprietary binary data format (SBDF).

Usage

exportDataToSBDF(data, file = "", keep = character(), drop = character(),
    rowNames = FALSE, rowsPerSlice = -1);

Arguments

data a data.frame or list object to export.
file a character string specifying the name of the Spotfire Binary Data File (SBDF) to create.
keep a character vector of column names or a numeric vector of column numbers. The columns specified are exported from data to the data file. You can provide either keep or drop, but not both.

The variable names to keep also can be placed in a file and separated by spaces, commas, or newlines. In this case, you can pass the name of the file to keep as a character string beginning with an ampersand "@". For example, keep="@keeplist.txt".

drop a character vector of column names or a numeric vector of column numbers. The columns specified are NOT exported from date to the data file. You can provide either keep or drop, but not both.

The variable names to drop also can be placed in a file and separated by spaces, commas, or newlines. In this case, you can pass the name of the file to drop as a character string beginning with the character "@". For example, drop="@droplist.txt".

rowNames a logical flag. If rowNames=TRUE, the row names are exported to the data file.
rowsPerSlice an integer representing the total number of data rows to write per table slice in the SBDF. Table slices are a way to group rows into blocks in n SBDF. If you specify a number greater than the total number of rows in the data to export, all the rows are written to the first table slice in the SBDF. If you specify a value less than 0, all the rows are written to the first table slice, as well.

Details

The following table shows the supported data types and how they are converted when you export from an R engine into SBDF:
R data type SBDF data type
logical Boolean
integer Integer (32 bit)
numeric Real
character String
factor String
POSIXct or POSIXlt DateTime
difftime TimeSpan
raw Binary
TIBCO Enterprise Runtime for R supports importing the Spotfire Currency data type (it imports it as numeric). TIBCO Enterprise Runtime for R does not support Currency natively.
Note: The Spotfire data type Currency contained in an SBDF file is imported to TIBCO Enterprise Runtime for R as numeric. If this numeric is then exported to an SDBF, it is converted to the Spotfire data type Real. This can result in a loss of precision for very large values.
SBDF does not support S or R factors (categorical data types), so these are represented as simple strings.
Value
NULL.
See Also
importDataFromSBDF
Examples
# Export the mtcars data to a temporary file:
tfile <- tempfile()
exportDataToSBDF(mtcars, tfile, rowNames=TRUE)
# Read the file in with importFromSBDF:
mtcars2 <- importDataFromSBDF(tfile, rowNamesCol=1)
all.equal(mtcars2, mtcars)  # two data objects are the same
# Clean up:
unlink(tfile)
Package SpotfireData version 4.0.0-28
Package Index