R: Compute the sparsity of a document-feature matrix

sparsity {quanteda} | R Documentation

## 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

    dfmat <- dfm(data_corpus_inaugural)
    sparsity(dfmat)
    sparsity(dfm_trim(dfmat, min_termfreq = 5))

[Package quanteda version 3.1.0 Index]