# pacchetti library(tidyverse) library(quanteda) quanteda_options(language_stemmer ="italian") library(quanteda.textplots) # dati load("dati/es_twitter.rda") # matrice delle co-occorrenze rt.fcm <- rt2 %>% mutate(text = str_replace_all(text, "[\'’]", "' ")) %>% corpus() %>% # tokenizzazione tokens(remove_punct = T) %>% # matrice documenti termini dfm() %>% # selezione dei soli hashtags dfm_select("#*") %>% # soglia di occorrenze dfm_trim(min_termfreq = 4) %>% # matrice delle cooccorrenze fcm() # network set.seed(345) textplot_network(rt.fcm[1:10,1:10]) + coord_equal() # grafo igraph g <- as.igraph(rt.fcm[1:10,1:10], weighted = T)