Learn R Programming

readMLData (version 0.9-7)

dsRead: Loading machine learning data from a directory tree using a unified interface.

Description

The function allows to read data sets included in the description in the data frame dsList into R environment using a unified interface.

Usage

dsRead(dsList, id, responseName = NULL, originalNames=TRUE, deleteUnused=TRUE, keepContents=FALSE)

Arguments

dsList
Data frame as created by prepareDSList().
id
Name of the data set in dsList$identification or the index of the row in dsList corresponding to the data set.
responseName
Character. The required name of the response column in the output data frame created from the data set.
originalNames
If TRUE, the original names of columns are used, if they are present in the description XML file.
deleteUnused
Logical. Controls, whether the columns containing case labels or other columns not suitable as attributes, are removed from the data.
keepContents
Logical. If TRUE, then deleteUnused parameter is ignored and no columns are converted to factors.

Value

A data frame containing the required data set, possibly transformed according to the setting of the parameters responseName, originalNames, deleteUnused. If an error occurred, the function outputs NULL.

Details

The function uses dsList$avaiable to determine, whether the files for the required data set is present in the local directory dsList$pathData. If not, a corresponding error message is printed. See prepareDSList() and getAvailable().

See Also

readMLData, prepareDSList, getAvailable.

Examples

Run this code
  pathData <- getPath("exampleData")
  pathDescription <- getPath("exampleDescription")
  dsList <- prepareDSList(pathData, pathDescription)
  dat <- dsRead(dsList, "glass")
  dim(dat)

Run the code above in your browser using DataLab