Simple calculation of document weights based on the average number of words in a document within the corpus (mean value = 1).

document_weights(document_term_table)

Arguments

document_term_table

Table of observation count data (rows: documents, columns: terms. May be a class matrix or data.frame but must be conformable to a matrix of integers, as verified by check_document_term_table.

Value

Vector of weights, one for each document, with the average sample receiving a weight of 1.0.

Examples

 data(rodents)
 document_weights(rodents$document_term_table)