View source: R/utils-textnets.R
doc_centrality | R Documentation |
Given a document-term matrix or a document-similarity matrix, this function returns specified text network-based centrality measures. Currently, this includes weighted degree, eigenvector, betweenness, and spanning.
doc_centrality(mat, method, alpha = 1L, scale = FALSE, two_mode = TRUE)
mat |
Document-term matrix with terms as columns or a document-similarity matrix with documents as rows and columns. |
method |
Character vector indicating centrality method, including weighted degree, eigenvector, spanning, and betweenness. |
alpha |
Number (default = 1) indicating the tuning parameter for weighted metrics. |
scale |
Logical (default = FALSE), indicating whether to scale output. |
two_mode |
Logical (default = TRUE), indicating whether the input matrix is two mode (i.e. a document-term matrix) or one-mode (i.e. document-similarity matrix) |
If a document-term matrix is provided, the function obtains the one-mode
document-level projection to get the document-similarity matrix using
tcrossprod()
. If a one-mode document-similarity matrix is provided, then
this step is skipped. This way document similiarities may be obtained
using other methods, such as Word-Mover's Distance. The diagonal is ignored
in all calculations.
A dataframe with two columns
Dustin Stoltz
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.