Analyze and Visualize Word Co-occurrence Networks
Source:R/text_mining_functions.R
word_co_occurrence_network.Rd
This function creates a word co-occurrence network based on a document-feature matrix (dfm).
Usage
word_co_occurrence_network(
dfm_object,
co_occur_n = 130,
top_node_n = 30,
height = 800,
width = 900
)
Arguments
- dfm_object
A quanteda document-feature matrix (dfm).
- co_occur_n
Minimum number of co-occurrences for filtering terms (default is 130).
- top_node_n
Number of top nodes to display (default is 30).
- height
The height of the resulting Plotly plot, in pixels. Defaults to
800
.- width
The width of the resulting Plotly plot, in pixels. Defaults to
900
.
Examples
if (interactive()) {
df <- TextAnalysisR::SpecialEduTech
united_tbl <- TextAnalysisR::unite_text_cols(df, listed_vars = c("title", "keyword", "abstract"))
tokens <- TextAnalysisR::preprocess_texts(united_tbl, text_field = "united_texts")
dfm_object <- quanteda::dfm(tokens)
word_co_occurrence_network_results <- TextAnalysisR::word_co_occurrence_network(
dfm_object,
co_occur_n = 130,
top_node_n = 30,
height = 800,
width = 900)
word_co_occurrence_network_results$plot
word_co_occurrence_network_results$table
word_co_occurrence_network_results$summary
}