dtm_melter: Melt a DTM into a triplet data frame

View source: R/utils-dtm.R

dtm_melterR Documentation

Melt a DTM into a triplet data frame

Description

Converts a DTM into a data frame with three columns: documents, terms, frequency. Each row is a unique document by term frequency. This is akin to reshape2 packages melt function, but works on a sparse matrix. The resulting data frame is also equivalent to the tidytext triplet tibble.

Usage

dtm_melter(dtm)

Arguments

dtm

Document-term matrix with terms as columns. Works with DTMs produced by any popular text analysis package, or using the dtm_builder() function.

Value

returns data frame with three columns: doc_id, term, freq

Author(s)

Dustin Stoltz


text2map documentation built on May 29, 2024, 2:54 a.m.