Learn R Programming

D2MCS (version 1.0.1)

DatasetLoader: Dataset creation.

Description

Wrapper class able to automatically create a Dataset, HDDataset according to the input data.

Arguments

Methods


Method new()

Empty function used to initialize the object arguments in runtime.

Usage

DatasetLoader$new()


Method load()

Stores the input source into a Dataset or HDDataset type object.

Usage

DatasetLoader$load(
  filepath,
  header = TRUE,
  sep = ",",
  skip.lines = 0,
  normalize.names = FALSE,
  string.as.factor = FALSE,
  ignore.columns = NULL
)

Arguments

filepath

The name of the file which the data are to be read from. Each row of the table appears as one line of the file. If it does not contain an _absolute_ path, the file name is _relative_ to the current working directory, 'getwd()'.

header

A logical value indicating whether the file contains the names of the variables as its first line. If missing, the value is determined from the file format: 'header' is set to 'TRUE' if and only if the first row contains one fewer field than the number of columns.

sep

The field separator character. Values on each line of the file are separated by this character.

skip.lines

Defines the number of header lines should be skipped.

normalize.names

A logical value indicating whether the columns names should be automatically renamed to ensure R compatibility.

string.as.factor

A logical value indicating if character columns should be converted to factors (default = FALSE).

ignore.columns

Specify the columns from the input file that should be ignored.

Returns

A Dataset or HDDataset object.

See Also

Dataset, HDDataset

Examples

Run this code
if (FALSE) {
# Create Dataset Handler object.
  loader <- DatasetLoader$new()

  # Load input file.
  data <- loader$load(filepath = system.file(file.path("examples",
                                                       "hcc-data-complete-balanced.csv"),
                                             package = "D2MCS"),
                      header = T, normalize.names = T)
}


Run the code above in your browser using DataLab