GetTopTerms: Get Top Terms for each topic from a topic model

Description Usage Arguments Value Examples

Description

Takes topics by terms matrix and returns top M terms for each topic

Usage

1
GetTopTerms(phi, M)

Arguments

phi

A matrix whose rows index topics and columns index words

M

An integer for the number of terms to return

Value

Returns a data.frame whose columns correspond to a topic and whose m-th row correspond to the m-th top term from the input phi.

Examples

1
2
3
4
5
6
7
# Load a pre-formatted dtm and topic model
data(nih_sample_dtm)
data(nih_sample_topic_model) 

top_terms <- GetTopTerms(phi = nih_sample_topic_model$phi, M = 5)

str(top_terms)

ChengMengli/topic documentation built on May 31, 2019, 8:44 p.m.