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

sparsity(x)

Arguments

x

the document-feature matrix

Examples

inaug_dfm <- dfm(data_corpus_inaugural, verbose = FALSE) sparsity(inaug_dfm)
#> [1] 0.9176184
sparsity(dfm_trim(inaug_dfm, min_count = 5))
#> Error in get(".SigLength", envir = env): object '.SigLength' not found