SF.read.DecisionTable: Reading tabular data from files.

View source: R/IOFunctions.R

SF.read.DecisionTableR Documentation

Reading tabular data from files.

Description

This function can be used to import data sets from files and then construct a DecisionTable object. It uses read.table function from base R.

Usage

SF.read.DecisionTable(filename, decision.attr = NULL, indx.nominal = NULL, ...)

Arguments

filename

a path with a file name.

decision.attr

an integer indicating an index of the decision attribute. See SF.asDecisionTable.

indx.nominal

an integer vector with indices of attributes which should be considered as nominal. See SF.asDecisionTable.

...

additional parameters which are passed to the read.table function. See read.table.

Details

The data should be in a tabular format containing rows and columns, where every row represents an object/instance, while columns represent attributes of the objects.

Value

An object of the "DecisionTable" class. See SF.asDecisionTable.

Author(s)

Andrzej Janusz

Examples

#############################################################
## Example 1: data set saved in a file
#############################################################
## Let us assume we have the following data which has been already saved to the file "tes.dat"
data <- data.frame(c(0.12, 0.23, 0.24), c(1,3,2), c(10, 12, 18), c("a", "a", "b"), c(1, 1, 2))
## Not run: write.table(data, file = "tes.dat", row.names = FALSE, col.names = FALSE,
                    fileEncoding ="")
## End(Not run)

## Then we would generate decision table from tes.dat file.
## in this case, we want to define that second and third attributes are nominal and continuous,
## respectively.
## Not run: decision.table <- SF.read.DecisionTable(filename = "tes.dat", decision.attr = 5,
                  indx.nominal = c(2, 5), sep= " ", col.names = c("v1", "v2", "v3", "v4", "o1"))
## End(Not run)


RoughSets documentation built on May 29, 2024, 7:34 a.m.