Learn R Programming

revtools (version 0.2.2)

make_DTM: Construct a document-term matrix (DTM)

Description

Takes bibliographic data and converts it to a DTM for passing to topic models.

Usage

make_DTM(x, stop_words)

Arguments

x

an object of class bibliography or data.frame containing bibliographic data

stop_words

optional vector of strings, listing terms to be removed from the DTM prior to analysis

Value

An object of class 'matrix', listing the terms (columns) present in each reference (rows)

Examples

Run this code
# NOT RUN {
# import some data
file_location<-system.file("extdata", "avian_ecology_bibliography.ris", package="revtools")
x<-read_bibliography(file_location)

# construct a document-term matrix
# note: this can take a long time to run for large datasets
x_DTM<-make_DTM(x)
dim(x_DTM) # 20 articles, 1069 words
# }

Run the code above in your browser using DataLab