feature_matrix: Convert tabular data to feature matrix

View source: R/preprocess.R

feature_matrixR Documentation

Convert tabular data to feature matrix

Description

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

Usage

feature_matrix(x)

Arguments

x

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

Details

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

Value

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

Author(s)

EDG

Examples

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

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.