tot_n_tokens {mclm}R Documentation

Retrieve or set the total number of tokens

Description

These methods retrieve or set the total number of tokens in the corpus on which the frequency counts are based. This total number of tokens may be higher than the sum of all frequency counts in x, for instance, if x contains frequency counts for a selection of items only, and not for all tokens in the corpus.

Usage

tot_n_tokens(x)

tot_n_tokens(x) <- value

## S3 replacement method for class 'freqlist'
tot_n_tokens(x) <- value

## S3 method for class 'freqlist'
tot_n_tokens(x)

Arguments

x

An object of any of the classes for which the method is implemented.

value

Numerical value.

Value

A number.

See Also

Other getters and setters: n_tokens(), n_types(), orig_ranks(), ranks(), type_names()

Examples

x <- freqlist("The man and the mouse.",
              re_token_splitter = "(?xi) [:\\s.;,?!\"]+",
              as_text = TRUE)
x
tot_n_tokens(x)

y <- keep_types(x, c("man", "and"))
tot_n_tokens(y)
y

tot_n_tokens(y) <- sum(y)
y
tot_n_tokens(y)

[Package mclm version 0.2.7 Index]