Learn R Programming

gofastr (version 0.3.0)

filter_documents: Remove Documents Below a Threshold from a TermDocumentMatrix/DocumentTermMatrix

Description

Remove documents from a TermDocumentMatrix or DocumentTermMatrix not meeting a rowSums/ colSums threshold. Useful for removing empty documents.

Usage

filter_documents(x, min = 1)

Arguments

min

A minimal threshold that a documents row/column must sum to.

Value

Returns a TermDocumentMatrix or DocumentTermMatrix.

Examples

Run this code
# NOT RUN {
(x <-with(presidential_debates_2012, q_dtm(dialogue, paste(time, tot, sep = "_"))))
filter_documents(x)
(y <- with(presidential_debates_2012, q_tdm(dialogue, paste(time, tot, sep = "_"))))
filter_documents(y)
# }

Run the code above in your browser using DataLab