importDataFromSBDF
Import Data from an SBDF File

Description

Imports a file from the TIBCO Spotfire binary data file format.

Usage

importDataFromSBDF(file = NULL, keep = character(0), drop = character(0), 
   startRow = 1, endRow = -1, rowNamesCol = -1, stringsAsFactors = FALSE,
   returnDataFrame = TRUE)

Arguments

file a character string specifying the name of the SBDF to import.
keep a character vector of column names or a numeric vector of column numbers. The columns specified are imported from 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 the character "@". For example, keep="@keeplist.txt".

drop a character vector of column names or a numeric vector of column numbers. The columns specified are NOT imported from 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".

startRow an integer specifying the first row to be imported from the data file. If you specify a value less than 1, it defaults to the first row in the file.
endRow an integer specifying the final row to be imported from the data file. If you specify a value less than 1 or less than startRow, it defaults to the last row in the file.
rowNamesCol an integer denoting the column that should be used for row names. The specified column is dropped from the resulting data frame.
stringsAsFactors a logical value. If stringsAsFactors=TRUE, strings are converted to factors when imported. The default is FALSE, which imports strings as characters.
returnDataFrame a logical value, if FALSE, the data is imported as a list and not converted to a data.frame. This can be useful if some columns in your data are binary, which can result in S raw columns with lengths different from the other columns, so no column replication is done. The default is TRUE, which imports the data as a data.frame.

Details

The following table shows the supported data types and how they are converted when you import from Spotfire into an R engine:
SBDF data type R data type
Boolean logical
Integer (32 bit) numeric
Currency* numeric
Long (64 bit) numeric
Float numeric
Real numeric
Decimal numeric
String character
Text character
DateTime POSIXct object with time zone UTC
Date POSIXct object with time zone UTC
Time POSIXct object with time zone UTC, specifying a time on the R epoch day 1/1/1970
TimeSpan difftime object with units secs
Binary raw
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. All table slices in the SBDF are automatically read.
Value
The imported data, as a data.frame if returnDataFrame is TRUE, or as a list if returnDataFrame is FALSE.
See Also
exportDataToSBDF
Examples
# Import the sample data file, pima.sbdf                                        
pimaFile <- system.file("sample/pima.sbdf", package="SpotfireData")
pima <- importDataFromSBDF(pimaFile)
Package SpotfireData version 4.0.0-28
Package Index