# \donttest{
# load some data
data(nih_sample_dtm)
# fit a model
set.seed(12345)
m <- tidylda(
data = nih_sample_dtm[1:20, ], k = 5,
iterations = 200, burnin = 175
)
# sample from the marginal posterior corresponding to topic 1
t1 <- posterior(
x = m,
matrix = "beta",
which = 1,
times = 100
)
# sample from the marginal posterior corresponding to documents 5 and 6
d5 <- posterior(
x = m,
matrix = "theta",
which = c(5, 6),
times = 100
)
# }
Run the code above in your browser using DataLab