Learn R Programming

quanteda (version 1.3.13)

sparsity: Compute the sparsity of a document-feature matrix

Description

Return the proportion of sparseness of a document-feature matrix, equal to the proportion of cells that have zero counts.

Usage

sparsity(x)

Arguments

x

the document-feature matrix

Examples

Run this code
# NOT RUN {
inaug_dfm <- dfm(data_corpus_inaugural, verbose = FALSE)
sparsity(inaug_dfm)
sparsity(dfm_trim(inaug_dfm, min_termfreq = 5))
# }

Run the code above in your browser using DataLab