Dataframe2BinaryMatrix: Converts a Data Frame into a Binary Data Matrix

View source: R/Dataframe2BinaryMatrix.R

Dataframe2BinaryMatrixR Documentation

Converts a Data Frame into a Binary Data Matrix

Description

Converts a Data Frame into a Binary Data Matrix

Usage

Dataframe2BinaryMatrix(dataf, cuttype = "Median", cut = NULL, BinFact = TRUE)

Arguments

dataf

data.frame to be converted

cuttype

Type of cut point for continuous variables. Must be "Median" or "Mean". Does not have any effect for factors

cut

Personalized cut value for continuous variables.

BinFact

Should I treat a factor with two levels as binary. This means that only a single dummy rather than two is used

Details

The function converts a data frame into a Binary Data Matrix (A matrix with entries either 0 or 1).

Factors with two levels are directly transformed into a column of 0/1 entries.

Factors with more than two levels are converted into a binary submatrix with as many rows as x and as many columns as levels or categories. (Indicator matrix)

Integer Variables are treated as factors

Continuous Variables are converted into binary variables using a cut point that can be the median, the mean or a value provided by the user.

Value

A Binary Data Matrix.

Author(s)

Jose Luis Vicente Villardon

Examples

data(spiders)
Dataframe2BinaryMatrix(spiders)

MultBiplotR documentation built on Nov. 21, 2023, 5:08 p.m.