contingency_table: Generates a contingency table from user-specified document...

Description Usage Arguments Value

View source: R/contingency_table.R

Description

Generates a contingency table from user-specified document covariates and a document term matrix.

Usage

1
2
contingency_table(metadata, document_term_matrix, vocabulary = NULL,
  variables_to_use = NULL, threshold = 0, force_dense = FALSE)

Arguments

metadata

A data.frame containing document covariates.

document_term_matrix

A documents x vocabulary matrix with counts of unique words in each document. Can be a dense or sparse matrix.

vocabulary

A character vector corresponding to the columns of the document word matrix. If NULL, the column names of doc_word_matrix will be used. Defaults to NULL.

variables_to_use

Defaults to NULL in which case all columns of the metadata data frame will be used. Otherwise can be specified as a vector of column indexes or column names.

threshold

Defaults to 0, the number of times a unique value of a variable must appear in order to be included in the returned list object. Allows the user to ignore very infrequent values.

force_dense

Forces the contingency table returned to be a dense matrix. The function will automatically generate a sparse matrix contingency table if the contingency table would have more than 100,000 entries.

Value

A contingency table.


matthewjdenny/SpeedReader documentation built on March 25, 2020, 5:32 p.m.