powered by
Transform a data frame into a matrix using one hot encoding.
as_model_matrix(df, intercept = FALSE)
A data frame.
Whether to have a column with all 1s. Default is FALSE.
1
FALSE
A matrix.
# NOT RUN { mat <- as_model_matrix(iris) str(mat) # }
Run the code above in your browser using DataLab