RxDataSource: RevoScaleR Data Source: Class Generator
Description
A generator for RxDataSource S4 classes.
Usage
RxDataSource( class = NULL, dataSource = NULL, ...)
Arguments
class
an optional character string specifying class name of the data source to be created, such as RxTextData, RxSpssData, RxSasData, RxOdbcData, or RxTeradata. If the class of the input dataSource differs from class
, contents of overlapping slots will be copied from the input data source to the newly constructed data source.
dataSource
an optional data source object to be cloned.
...
any other arguments to be applied to the newly constructed data source.
Details
If class
is specified, the returned object will be of that class.
If not, the returned object will have the class of dataSource
.
If both class
and dataSource
are specified, the contents of
matching slots will be copied from the input dataSource
to the
output object. Additional arguments will then be applied.
Value
A type of RxDataSource data source object.
Author(s)
Microsoft Corporation Microsoft Technical Support
See Also
RxDataSource-class, RxTextData, RxSqlServerData, RxSpssData, RxSasData, RxOdbcData, RxTeradata, RxXdfData.
Examples
claimsSpssName <- file.path(rxGetOption("sampleDataDir"), "claims.sav")
claimsTextName <- file.path(rxGetOption("sampleDataDir"), "claims.txt")
claimsColInfo <- list(
age = list(type = "factor",
levels = c("17-20", "21-24", "25-29", "30-34", "35-39", "40-49", "50-59", "60+")),
car.age = list(type = "factor", levels = c("0-3", "4-7", "8-9", "10+")),
type = list(type = "factor", levels = c("A", "B", "C", "D"))
)
textDS <- RxTextData(file = claimsTextName, colInfo = claimsColInfo)
# Create an SPSS data source from the text data source
# The 'colInfo' will be carried over to the SPSS data source
# and the file name will be replaced
spssDS <- RxDataSource(class = "RxSpssData", dataSource = textDS, file = claimsSpssName)