Learn R Programming

mdatools (version 0.14.1)

mda.df2mat: Convert data frame to a matrix

Description

The function converts data frame to a numeric matrix.

Usage

mda.df2mat(x, full = FALSE)

Value

a numeric matrix

Arguments

x

a data frame

full

logical, if TRUE number of dummy variables for a factor will be the same as number of levels, otherwise by one smaller

Details

If one or several columns of the data frame are factors they will be converted to a set of dummy variables. If any columns/rows were hidden in the data frame they will remain hidden in the matrix. If there are factors among the hidden columns, the corresponding dummy variables will be hidden as well.

All other attributes (names, axis names, etc.) will be inherited.