Description Usage Arguments Value See Also Examples
View source: R/adjacency_matrix.R
Takes a matrix (wfm) or termco object and generates an adjacency matrix for use with the igraph package.
1 2 3 | adjacency_matrix(matrix.obj)
adjmat(matrix.obj)
|
matrix.obj |
A matrix object, preferably, of the class "termco"
generated from |
Returns list:
boolean |
A Boolean matrix |
adjacency |
An adjacency matrix. Diagonals are the total (sum) number of occurrences a variable had |
shared |
An adjacency matrix with no diagonal and the upper triangle replaced with NA |
sum |
The diagonal of the adjacency matrix; the total (sum) number of occurrences a variable had |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
words <- c(" you", " the", "it", "oo")
Terms <- with(DATA, termco(state, list(sex, adult), words))
Terms
adjacency_matrix(Terms)
wordLIST <- c(" montague", " capulet", " court", " marry")
raj.termco <- with(raj.act.1, termco(dialogue, person, wordLIST))
raj.adjmat <- adjmat(raj.termco)
names(raj.adjmat) #see what's available from the adjacency_matrix object
library(igraph)
g <- graph.adjacency(raj.adjmat$adjacency, weighted=TRUE, mode ="undirected")
g <- simplify(g)
V(g)$label <- V(g)$name
V(g)$degree <- degree(g)
plot(g, layout=layout.auto(g))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.