textplot_correlation_glasso {textplot} | R Documentation |
Plot sparse term correlations as a graph structure
Description
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.
Usage
textplot_correlation_glasso(x, ...)
## Default S3 method:
textplot_correlation_glasso(
x,
n = 1000,
exclude_zero = TRUE,
label.cex = 1,
node.width = 0.5,
...
)
Arguments
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 |
Value
an object of class ggplot
Examples
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)
[Package textplot version 0.2.2 Index]