View source: R/dtr_matrix2df.R
dtr_matrix2df | R Documentation |
Data transformation: Converts a matrix
to data.table
and
encodes categorical variables as factor
.
dtr_matrix2df(matrix, cat_vars = NULL)
matrix |
An R |
cat_vars |
A character vector with colnames that should be converted to
|
A data.table
is returned.
data("iris")
mat <- data.matrix(iris)
dataset <- dtr_matrix2df(mat)
str(dataset)
dataset <- dtr_matrix2df(mat, cat_vars = "Species")
str(dataset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.