Skip to contents

plot a network of co-occurrence of terms, as returned by extract_graph and then by dplyr::count(). The size of words and compound words means the individual frequency of each word/compound word. The thickness of the links indicates how often the pair occur together.

Usage

net_wordcloud(text, df, head_n = 30, color = "lightblue")

Arguments

text

the original text used to extract the graph. It is necessary to calculate the individual frequency of the words.

df

a dataframe of co-occurrence, extracted with `extract_graph()` and `count(n1, n2)`

head_n

number of nodes to show - the more frequent

Examples


# stopwords:
my_sw <- c(stopwords::stopwords(language = "en", source = "snowball", simplify = TRUE), "lol")

txt_wiki |> # text available in the package
  # because it is a vector, let's collapse it into a single element:
  paste(collapse = " ") |>
  extract_graph(sw = my_sw) |>
  networds::count_graphs() |> # counting the graphs
  net_wordcloud(ex_txt_wiki, df = _) # plotting
#> Tokenizing by sentences
#> Error: object 'ex_txt_wiki' not found