Learn R Programming

SDR (version 0.7.0.0)

keelFromDataFrame: Creates a keel object from a data.frame

Description

Creates a keel object from a data.frame and create fuzzy labels for numerical variables too.

Usage

keelFromDataFrame(data, relation, nLabels = 3, names = NA, types = NA, classNames = NA)

Arguments

data
A data.frame object with all neccesary information. See details.
relation
A string that indicate the name of the relation.
nLabels
The number of fuzzy labels to use. By default 3.
names
An optional character vector indicating the name of the attributes.
types
An optional character vector indicating 'c' if variable is categorical, 'r' if is real and 'e' if it is an integer
classNames
An optional character vector indicating the values of the target class.

Value

A keel object with all the information of the dataset.

Details

The information of the data.frame must be stored with instances in rows and variables in columns If you dont specify any of the optional parameter the function try to obtain them automatically.

For 'names' if it is NA, the function takes the name of the columns by colnames.

For 'types' if it is NA, the function takes the type of an attribute asking the type of the column of the data.frame. If it is 'character' it is assumed that it is categorical, and if 'numeric' it is assumed that it is a real number. PLEASE, PAY ATTENTION TO THIS WAY OF WORK. It can cause tranformation errors taking a numeric variable as categorical or vice-versa.

For 'classNames' if it is NA, the function returns unique values of the last attribute of the data.frame that is considered the class attribute.

See Also

read.keel

Examples

Run this code
library(SDR)
df <- data.frame(matrix(runif(1000), ncol = 10))
#Add class attribute
df[,11] <- c("0", "1")
keelObject <- keelFromDataFrame(df, "random")
invisible()

Run the code above in your browser using DataLab