exportData
Export Data to an External File Format
Description
Exports a data frame in a format that is supported by the StatTransfer product.
Usage
exportData(x, file = NULL, format = NULL, drop = NULL,
keep = NULL, control = NULL)
Arguments
x |
a data frame to export.
|
file |
a character string containing the name of the file to write the data to.
The file extension determines the file format
unless the format argument is supplied.
|
format |
a character string specifying the file format to be used
to create file.
It must be one of the values from the FormatTag column in
the stattranFileFormats data set.
Typically, this argument is not required, because if it is not supplied,
the file extension of the file argument determines the format.
|
drop |
a character vector of column names from x that are not
included in the export file. All other columns will be exported.
If drop is specified, the keep argument cannot be used.
|
keep |
a character vector of column names from x that are
included in the export file.
Only the columns listed are exported.
If keep specified, the drop argument cannot be used.
|
control |
a named list of control options for the StatTransfer library.
Typically, this is created in a call to stattran.control.
|
Value
returns an integer: the number of observations written to file.
References
See Also
Examples
tf01 <- paste0(tempfile(), ".csv")
df01 <- data.frame(x = 1:7, c = letters[11:17],
d = seq.Date(as.Date("2011-05-23"), by=1, length.out=7))
exportData(df01, file=tf01)
## [1] 7
exportData(df01, file=tf01, control=list("date-fmt-write" = "%m.%d.%Y"))