topicmodels - tidy Error in eval(substitute(expr), envir, enclos) : binding not found: 'Var1' -
when apply tidy function result of lda model in dataset, following error "error in eval(substitute(expr), envir, enclos) : binding not found: 'var1'". same error when used on associated press example, shown below. tried reinstalling tidytext via devtools::install_github("juliasilge/tidytext") , still same result. there else can try?
library(tidyr) library(tidytext) library(tidyverse) library(topicmodels) library(broom)
data("associatedpress") associatedpress
ap_lda <- lda(associatedpress, k = 2, control = list(seed = 1234)) ap_lda
ap_topics <- tidy(ap_lda, matrix = "beta") ap_topics
<> 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 lda_vem topic model 2 topics.
ap_topics <- tidy(ap_lda, matrix = "beta") error in eval(substitute(expr), envir, enclos) : binding not found: 'var1' ap_topics
i cannot reproduce problem.
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 #> lda_vem topic model 2 topics. ap_topics <- tidy(ap_lda, matrix = "beta") ap_topics #> # tibble: 20,946 x 3 #> topic term beta #> <int> <chr> <dbl> #> 1 1 aaron 1.686917e-12 #> 2 2 aaron 3.895941e-05 #> 3 1 abandon 2.654910e-05 #> 4 2 abandon 3.990786e-05 #> 5 1 abandoned 1.390663e-04 #> 6 2 abandoned 5.876946e-05 #> 7 1 abandoning 2.454843e-33 #> 8 2 abandoning 2.337565e-05 #> 9 1 abbott 2.130484e-06 #> 10 2 abbott 2.968045e-05 #> # ... 20,936 more rows
do have package loaded, maybe? user had problem reshape package.
Comments
Post a Comment