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.
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.
Secondary word for which the association with the keyword used in ttt_keyness is to be extracted.
A quanteda 'keyness' object filtered to the specified associations only (see 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.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.