Throws away all variables and constructs a documnt feature matrix with column names from the types of whatever is counted in 'counts' ans row names from a chosen variable, or doc_id.
jl_dfm(x, rownames_from = "doc_id", inflate = FALSE)
x | a tibble |
---|---|
rownames_from | which variable to take the row names from (default: doc_id) |
inflate | whether to return a dense base::matrix (TRUE) or a Matrix::sparseMatrix |
a matrix
Note that requesting an inflated document feature matrix turns a Matrix::sparseMatrix into a regular base::matrix and may increase memory consumption considerably.