View source: R/textplot_corglasso.R
textplot_correlation_glasso | R Documentation |
Plot sparse term correlations as a graph structure.
Uses the glasso procedure (glasso::glassopath
) to reduce the correlation matrix to retain only the
relevant correlations and next visualises these sparse correlations.
textplot_correlation_glasso(x, ...) ## Default S3 method: textplot_correlation_glasso( x, n = 1000, exclude_zero = TRUE, label.cex = 1, node.width = 0.5, ... )
x |
a correlation matrix |
... |
further arguments passed on to |
n |
sample size used in computing the sparse correlation matrix. Defaults to 1000. |
exclude_zero |
logical indicating to exclude zero-correlations from the graph |
label.cex |
passed on to |
node.width |
passed on to |
an object of class ggplot
library(udpipe) library(qgraph) library(glasso) data(brussels_reviews_anno, package = 'udpipe') x <- subset(brussels_reviews_anno, xpos %in% "NN" & language %in% "fr" & !is.na(lemma)) x <- document_term_frequencies(x, document = "doc_id", term = "lemma") dtm <- document_term_matrix(x) dtm <- dtm_remove_lowfreq(dtm, maxterms = 60) m <- dtm_cor(dtm) textplot_correlation_glasso(m, exclude_zero = TRUE) textplot_correlation_glasso(m, exclude_zero = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.