Learn R Programming

mclm (version 0.2.7)

orig_ranks: Retrieve or set original ranks

Description

These methods retrieve or set, for a the original ranks for the frequency counts of an object. These original ranks are only defined if x is the result of a selection procedure (i.e. if x contains frequency counts for a selection of items only, and not for all tokens in the corpus).

Usage

orig_ranks(x, ...)

orig_ranks(x) <- value

# S3 method for freqlist orig_ranks(x) <- value

# S3 method for freqlist orig_ranks(x, with_names = FALSE, ...)

# S3 method for default orig_ranks(x) <- value

Value

Either NULL or a numeric vector, representing the original ranks, with as its names the types to which these ranks apply.

Arguments

x

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

...

Additional arguments.

value

Currently it can only be NULL.

with_names

Logical. Whether or not the items in the output should be given names. If TRUE, then the names of the types in the frequency list are used as names.

See Also

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

Examples

Run this code
x <- freqlist("The man and the mouse.",
              as_text = TRUE)
x
orig_ranks(x)
orig_ranks(x, with_names = TRUE)

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

orig_ranks(y) <- NULL
y
orig_ranks(y)

tot_n_tokens(y) <- sum(y)
y

Run the code above in your browser using DataLab