Learn R Programming

quanteda (version 4.1.0)

format_sparsity: format a sparsity value for printing

Description

Inputs a dfm sparsity value from sparsity() and formats it for printing in print.dfm().

Usage

format_sparsity(x)

Arguments

x

input sparsity value, ranging from 0 to 1.0

Examples

Run this code
ss <- c(1, .99999, .9999, .999, .99, .9,
       .1, .01, .001, .0001, .000001, .0000001, .00000001, .000000000001, 0)
for (s in ss) 
    cat(format(s, width = 10),  ":", quanteda:::format_sparsity(s), "\n")

Run the code above in your browser using DataLab