% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/s3.R
\name{tidy.tmfast}
\alias{tidy.tmfast}
\title{Extract beta and gamma matrices from \code{tmfast} objects}
\usage{
\method{tidy}{tmfast}(
  x,
  k,
  matrix = "beta",
  df = TRUE,
  exponent = NULL,
  keep_original = FALSE,
  rotation = NULL,
  ...
)
}
\arguments{
\item{x}{\code{tmfast} object}

\item{k}{Index (number of topics/factors)}

\item{matrix}{Desired matrix, either word-topic (\code{beta}) or topic-doc distributions (\code{gamma})}

\item{df}{Return a long dataframe (default) or wide matrix?}

\item{exponent}{Renormalize the probabilities using a given exponent  Applies only for \code{df == TRUE}}

\item{keep_original}{If renormalizing, return original (pre-renormalized) probabilities?}

\item{rotation}{Optional rotation matrix; see details}

\item{...}{Not used; required for S3 method compatibility}
}
\value{
A long dataframe, with one row per word-topic or topic-doc combination. Column names depend on the value of \code{matrix}.
}
\description{
Extract beta and gamma matrices from \code{tmfast} objects
}
\details{
If \code{rotation} is not \code{NULL}, loadings/scores will be rotated.  This might be used to align the fitted topics with known true topics, as in the \code{journal_specific} simulation.  Loadings are left-multiplied by the given rotation, while scores are right-multiplied by the transpose of the given rotation.
}
\examples{
\donttest{
set.seed(42)
theta  = rdirichlet(50, 1, k = 3)
phi    = rdirichlet(3, 0.1, k = 20)
corpus = draw_corpus(rep(50L, 50), theta, phi)
model  = tmfast(corpus, n = 3)
tidy(model, k = 3, matrix = 'beta')
tidy(model, k = 3, matrix = 'gamma')
}
}
