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.9176184sparsity(dfm_trim(inaug_dfm, min_termfreq = 5))#> Error in .setupMethodsTables(fdef): trying to get slot "group" from an object of a basic class ("NULL") with no slots