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) <- valueArguments
- 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.
Value
Either NULL or a numeric vector, representing the
original ranks, with as its names the types to which these ranks apply.
See also
Other getters and setters:
n_tokens(),
n_types(),
ranks(),
tot_n_tokens(),
type_names()
Examples
x <- freqlist("The man and the mouse.",
as_text = TRUE)
x
#> Frequency list (types in list: 4, tokens in list: 5)
#> rank type abs_freq nrm_freq
#> ---- ----- -------- --------
#> 1 the 2 4000
#> 2 and 1 2000
#> 3 man 1 2000
#> 4 mouse 1 2000
orig_ranks(x)
#> NULL
orig_ranks(x, with_names = TRUE)
#> NULL
y <- keep_types(x, c("man", "and"))
orig_ranks(y)
#> [1] 3 2
y
#> Frequency list (types in list: 2, tokens in list: 2)
#> <total number of tokens: 5>
#> rank orig_rank type abs_freq nrm_freq
#> ---- --------- ---- -------- --------
#> 2 3 man 1 2000
#> 1 2 and 1 2000
orig_ranks(y) <- NULL
y
#> Frequency list (types in list: 2, tokens in list: 2)
#> <total number of tokens: 5>
#> rank type abs_freq nrm_freq
#> ---- ---- -------- --------
#> 2 man 1 2000
#> 1 and 1 2000
orig_ranks(y)
#> NULL
tot_n_tokens(y) <- sum(y)
y
#> Frequency list (types in list: 2, tokens in list: 2)
#> rank type abs_freq nrm_freq
#> ---- ---- -------- --------
#> 2 man 1 5000
#> 1 and 1 5000
