as.matrix.phraseDoc {phm} | R Documentation |
Convert a phraseDoc Object to a Matrix
Description
Convert a phraseDoc Object to a Matrix
Usage
## S3 method for class 'phraseDoc'
as.matrix(x, ids = TRUE, sparse = FALSE, ...)
Arguments
x |
A phraseDoc object. |
ids |
A logical value with TRUE (default) to use ids (if available), FALSE to use indices |
sparse |
A logical value indicates whether a sparse matrix should be returned (default FALSE) |
... |
Additional arguments |
Value
A matrix with phrases as rows, texts as columns, and elements containing the number of times the phrase occurs in the text
Examples
tst=c("This is a test text",
"This is a test text 2",
"This is another test text",
"This is another test text 2",
"This girl will test text that man",
"This boy will test text that man")
pd=phraseDoc(tst)
as.matrix(pd)
[Package phm version 1.1.2 Index]