Learn R Programming

rtemis (version 1.4.3)

feature_matrix: Convert tabular data to feature matrix

Description

Convert a tabular dataset to a matrix, one-hot encoding factors, if present.

Usage

feature_matrix(x)

Value

Matrix with features. Factors are one-hot encoded, if present.

Arguments

x

tabular data: Input data to convert to a feature matrix.

Author

EDG

Details

This is a convenience function that uses features(), preprocess(), as.matrix().

Examples

Run this code
# reorder columns so that we have a categorical feature
x <- set_outcome(iris, "Sepal.Length")
feature_matrix(x) |> head()

Run the code above in your browser using DataLab