Learn R Programming

tidylda (version 0.0.7)

tidy.tidylda: Tidy a matrix from a tidylda topic model

Description

Tidy the result of a tidylda topic model

Usage

# S3 method for tidylda
tidy(x, matrix, log = FALSE, ...)

# S3 method for matrix tidy(x, matrix, log = FALSE, ...)

Value

Returns a tibble.

If matrix = "beta" then the result is a table of one row per topic and token with the following columns: topic, token, beta

If matrix = "theta" then the result is a table of one row per document and topic with the following columns: document, topic, theta

If matrix = "lambda" then the result is a table of one row per topic and token with the following columns: topic, token, lambda

Arguments

x

an object of class tidylda or an individual beta, theta, or lambda matrix.

matrix

the matrix to tidy; one of 'beta', 'theta', or 'lambda'

log

do you want to have the result on a log scale? Defaults to FALSE

...

other arguments passed to methods,currently not used

Functions

  • tidy(matrix): Tidy an individual matrix. Useful for predictions and called from tidy.tidylda

Examples

Run this code
# \donttest{
dtm <- nih_sample_dtm

lda <- tidylda(data = dtm, k = 10, iterations = 100, burnin = 75)

tidy_beta <- tidy(lda, matrix = "beta")

tidy_theta <- tidy(lda, matrix = "theta")

tidy_lambda <- tidy(lda, matrix = "lambda")
# }

Run the code above in your browser using DataLab