This is a simple tutorial written by0 Assoc. Prof. Dr. Bishnu Prasad Gautam about Topics Modeling in R. In order to practices the “topicmodels” in R, you need to install the following packages. install.packages(“topicmodels”, dependencies = TRUE)

library(topicmodels)
## Warning: package 'topicmodels' was built under R version 4.0.3
library(lda)
## Warning: package 'lda' was built under R version 4.0.3

The above statement of library(topicmodels) is to load the library required for topic models. Topic model is a type of statistical model that summarize the document in terms of words frequency and discover the hidden semantic of document structure. It is the concept of finding the particular topic from the frequency of words. That means while the frequency of same words are increased, the content of that document will be about that topic. For example, if the document has more about red-panda (i.e 90%) than beer (10%) then, the topic of the document is more about red-panda.

In topic modeling, the latent semantic analysis is also used to identify clustering within the texts. # Simple Topic Modeling

data("AssociatedPress")

By using above statement, you are preparing an article of AssociatedPress which is included in the topicmodels.

AP_topic_model<-LDA(AssociatedPress, k=10, control = list(seed = 121))