Closed angoodkind closed 7 years ago
Hmmmmm, I am not able to reproduce this error. :confused:
library(tidyverse)
library(tidytext)
library(broom)
library(topicmodels)
data("AssociatedPress", package = "topicmodels")
AssociatedPress
#> <<DocumentTermMatrix (documents: 2246, terms: 10473)>>
#> Non-/sparse entries: 302031/23220327
#> Sparsity : 99%
#> Maximal term length: 18
#> Weighting : term frequency (tf)
ap_lda <- LDA(AssociatedPress, k = 2, control = list(seed = 1234))
ap_lda
#> A LDA_VEM topic model with 2 topics.
ap_documents <- tidy(ap_lda, matrix = "gamma")
ap_documents
#> # A tibble: 4,492 x 3
#> document topic gamma
#> <int> <int> <dbl>
#> 1 1 1 0.2480616686
#> 2 2 1 0.3615485445
#> 3 3 1 0.5265844180
#> 4 4 1 0.3566530023
#> 5 5 1 0.1812766762
#> 6 6 1 0.0005883388
#> 7 7 1 0.7734215655
#> 8 8 1 0.0044516994
#> 9 9 1 0.9669915139
#> 10 10 1 0.1468904793
#> # ... with 4,482 more rows
Do you have updated versions of these packages and R?
Ugh, I restarted R and the error went away. Sorry about this. Love the tutorial.
Loving this tutorial. Everything works fine until 6.1.2: When I run
ap_documents <- tidy(ap_lda, matrix = "gamma")
I get:Full code: