Plots terms preceding/proceeding a chosen term to give more context around how it is used in conversation.

term_context(df, text_var, term, preceding_n, proceeding_n, top_n)

Arguments

df

A dataframe.

text_var

The variable containing text.

term

The chosen term in lowercase.

preceding_n

An integer representing the number of terms to precede the chosen term.

proceeding_n

An integer representing the number of terms to proceed the chosen term.

top_n

The maximum number of ngrams to display, filtered by ngram count.

Value

A graph displaying the links between terms, and an ngram frequency table.