Description Usage Arguments Value Examples
Inputs a dfm sparsity value from sparsity()
and formats it for
printing in print.dfm()
.
1 | format_sparsity(x, threshold = 0.01, digits = 3, nsmall = 1)
|
x |
input sparsity value, ranging from 0 to 1.0 |
threshold |
value below which the decimal places will be rounded and printed with an inequality |
digits |
|
nsmall |
|
character
value for inserting into the dfm print output
1 2 3 4 5 6 7 8 | s <- c(.9, .99, .999, .9999, .99999,
.1, .01, .001, .0001, .000001, .0000001, .00000001, .000000000001,
sparsity(dfm(data_corpus_inaugural)),
.12312431242134)
for (i in s)
print(paste0(format(i, width = 10), ": ", quanteda.core:::format_sparsity(i)))
print(as.dfm(Matrix::rsparsematrix(1000, 1000, density = 0.9999)))
print(as.dfm(Matrix::rsparsematrix(10000, 10000, density = 0.00001)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.