Learn R Programming

KDViz (version 1.3.1)

DTMFromCorpus: Obtain a document-term matrix from corpus

Description

Obtain a matrix, better known as document-term matrix (DTM), where rows correspond to documents and rows to terms.

Usage

DTMFromCorpus(corpus, rowNames)

Arguments

corpus

a corpus obtained from a bibliographic database.

rowNames

a list of row names for the resulting document-term matrix to bring traceability of the names of the articles from the initial database.

Value

a matrix object i.e. a document-term matrix, weighted by the binary method.

Details

A quick process for obtaining a document-term matrix from a text corpus. The chosen method for weighting this matrix is the binary method, so entries of this matrix are 1 if the i-th term belongs to the j-th document and zero otherwise.

Examples

Run this code
# NOT RUN {
data("KDVizData")
data("KDCorpus")

myDTM <- DTMFromCorpus(corpus = KDCorpus, rowNames = row.names(KDVizData))
# }

Run the code above in your browser using DataLab