Return the names of the types in an object
Source:R/generics.R
, R/assoc.R
, R/freqlist.R
type_names.Rd
This method returns the names of the types represented in an object.
Usage
type_names(x, ...)
# S3 method for assoc_scores
type_names(x, ...)
# S3 method for freqlist
type_names(x, ...)
Arguments
- x
An object of any of the classes for which the method is implemented.
- ...
Additional arguments.
See also
Other getters and setters:
n_tokens()
,
n_types()
,
orig_ranks()
,
ranks()
,
tot_n_tokens()
Examples
# for a freqlist object
(flist <- freqlist("The man and the mouse.", as_text = TRUE))
#> 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
type_names(flist)
#> [1] "the" "and" "man" "mouse"
# for an assoc_scores object
a <- c(10, 30, 15, 1)
b <- c(200, 1000, 5000, 300)
c <- c(100, 14, 16, 4)
d <- c(300, 5000, 10000, 6000)
types <- c("four", "fictitious", "toy", "examples")
(scores <- assoc_abcd(a, b, c, d, types = types))
#> Association scores (types in list: 4)
#> type a PMI G_signed| b c d dir exp_a DP_rows
#> 1 four 10 -1.921 -45.432| 200 100 300 -1 37.869 -0.202
#> 2 fictitious 30 2.000 56.959|1000 14 5000 1 7.498 0.026
#> 3 toy 15 0.536 2.984|5000 16 10000 1 10.343 0.001
#> 4 examples 1 2.067 1.473| 300 4 6000 1 0.239 0.003
#> <number of extra columns to the right: 7>
#>
type_names(scores)
#> [1] "four" "fictitious" "toy" "examples"