powered by
Convert a tabular dataset to a matrix, one-hot encoding factors, if present.
feature_matrix(x)
Matrix with features. Factors are one-hot encoded, if present.
tabular data: Input data to convert to a feature matrix.
EDG
This is a convenience function that uses features(), preprocess(), as.matrix().
features()
preprocess()
as.matrix()
# 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