exportDataToSBDF(data, file = "", keep = character(), drop = character(), rowNames = FALSE, rowsPerSlice = -1);
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. |
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 | ||
# 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)