type_freqs {mclm}R Documentation

Retrieve frequencies from 'freqlist' object

Description

type_freq and type_freqs retrieve the frequency of all or some of the items of a freqlist object.

Usage

type_freqs(x, types = NULL, with_names = FALSE, ...)

type_freq(x, types = NULL, with_names = FALSE, ...)

Arguments

x

Object of class freqlist.

types

NULL or a character vector or an object of the class types.

If the argument types is NULL, then the frequencies of all the items in x are returned, in the order in which these items appear in x.

If the argument types is a character vector or an object of the class types, then only the frequencies (in x) of the items in types are given, in the order in which these items appear in types. For all items in types that do not occur in x, a frequency of zero is returned.

with_names

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

...

Additional arguments.

Value

Numeric vector representing the frequencies of the items.

See Also

type_names

Examples

(flist <- freqlist("The man and the mouse.", as_text = TRUE))

type_freqs(flist) # frequencies of all items
type_names(flist) # names of all items

type_freqs(flist, with_names = TRUE) # frequencies of all types, with names
type_freqs(flist, c("man", "the")) # frequencies of specific items ...
type_freqs(flist, c("the", "man")) # ... in the requested order
type_freq(flist, "the")            # frequency of one item

# frequencies of specific items can also be printed using subsetting
flist[c("the", "man")] 
flist["the"]

[Package mclm version 0.2.7 Index]