ttt_keyness2: ttt_keyness2

Description Usage Arguments Value Note Examples

Description

Extract association with a specified word from the results of ttt_keyness. The first function calculates associations with a specified word; this function reduces those only to associations with a second specified word.

Usage

1
ttt_keyness2(x, word)

Arguments

x

Either a single quanteda 'keyness' object, as for example returned from ttt_keyness, or a list of such objects, as for example return from ttt_keyness_annual.

word

Secondary word for which the association with the keyword used in ttt_keyness is to be extracted.

Value

A quanteda 'keyness' object filtered to the specified associations only (see Note).

Note

For single 'keyness' objects, this function is merely a very thin wrapped around dplyr 'filter'. For annual lists of 'keyness' objects returned from ttt_keyness_annual, each year is filtered to the specified associations only, and the list converted to a single 'keyness' 'data.frame' with an additional 'year' column.

Examples

1
2
3
4
5
6
7
8
9
# prepare a corpus of quanteda tokens:
dat <- quanteda::data_corpus_inaugural
tok <- quanteda::tokens (dat, remove_numbers = TRUE, remove_punct = TRUE,
               remove_separators = TRUE)
tok <- quanteda::tokens_remove(tok, quanteda::stopwords("english"))
# then use that to extract keyword associations:
x <- ttt_keyness (tok, "politic*")
# and filter to specified association only
x <- ttt_keyness2 (x, "petty")

mpadge/texttimetravel documentation built on Nov. 14, 2020, 11:31 a.m.