Description Usage Arguments Value Examples
dfToSparse
performs one-hot encoding to characters and factor types
within a data frame. The encoding is returned as a sparse matrix.
1 | dfToSparse(x, transpose = FALSE)
|
x |
A data frame to convert into a sparse matrix. Only character and factor types are converted through one-hot encoding. |
transpose |
A boolean determining if you should query by columns instead of the default of rows (only for sparse matricies). |
A sparse matrix with one-hot encoded columns, numeric and integer columsn are preserved in this sparse matrix. Column names are returned.
1 2 | x <- matrix(runif(20),10,2)
neighbors <- dfToSparse(x_df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.