View source: R/nlp_cooccurrence.R
| as.matrix.cooccurrence | R Documentation |
Convert the result of cooccurrence to a sparse matrix.
## S3 method for class 'cooccurrence' as.matrix(x, ...)
x |
an object of class |
... |
not used |
a sparse matrix with in the rows and columns the terms and in the cells how many times the cooccurrence occurred
cooccurrence
data(brussels_reviews_anno)
## By document, which lemma's co-occur
x <- subset(brussels_reviews_anno, xpos %in% c("NN", "JJ") & language %in% "fr")
x <- cooccurrence(x, group = "doc_id", term = "lemma")
x <- as.matrix(x)
dim(x)
x[1:3, 1:3]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.