运行此脚本,直接从“文本挖掘与R”,
library(topicmodels)
library(broom)
data("AssociatedPress")
ap_lda <- LDA(AssociatedPress, k = 2, control = list(seed = 1234))
tidy(ap_lda)
我收到此错误信息:
在as.data.frame.default(x)的误差:不能强制类 “结构(” LDA_VEM “包= ”topicmodels“)” 发送给> data.frame此外:警告消息:在tidy.default(ap_lda):用于整理类LDA_VEM的S3对象,使用as.data.frame没有方法
packageVersion("broom")
'0.4.3'
packageVersion("topicmodels")
'0.2.7'
sessionInfo()
ř版本3.4.3(2017年11月30日)平台:x86_64的-W64-的mingw32 / 64(64位)下运行:视窗> = 8 64(建立9200)
矩阵产品:默认
附基础包:[1]统计图形grDevices utils的数据集的方法基
其他附包:[1] broom_0.4.3 topicmodels_0.2-7
经由一个命名空间加载(和未附):[1] NLP_0.1-11 Rcpp_0.12.15 compiler_3.4.3 pillar_1.1.0 plyr_1.8.4
[6] bindr_0.1 base64enc_0.1-3 keras_2.1.3 tools_3.4.3 zeallot_0.1.0
[11] jsonlite_1.5 tibble_1.4.2 nlme_3.1-131 lattice_0.20-35 pkgconfig_2.0.1
[16] rlang_0.1.6 psych_1.7.8 yaml_2.1.16 parallel_3.4.3 bindrcpp_0.2
[21] stringr_1.2.0 dplyr_0.7.4 xml2_1.2.0 stats4_3.4.3 grid_3.4.3
[26] reticulate_1.4 glue_1.2.0 R6_2.2.2 foreign_0.8-69 tidyr_0.8.0
[31] purrr_0.2.4 reshape2_1.4.3 magrittr_1.5 whisker_0.3-2 tfruns_1.2
[36] modeltools_0.2-21 assertthat_0.2.0 mnormt_1.5-5 tensorflow_1.5 stringi_1.1.6
[41] slam_0.1-42 tm_0.7-3