As many had the issues, Max asked me to share my solution for merging the result of the model analysis with the original corpus in order to visualize it:
length(topics(lda.model)) #the length of the lda-model I have created
#both objects do not share the same length
#therefore, we create a new dataframe with the original corpus
df <- data.frame(text=as.character(corp_manif))
df$id <- names(corp_manif)
df$partyyear <- manif$partyyear #I add the partyyear variable to identify the resepctive party manifesto
#now we create a document with the model data
doc_topics <- tidy(lda.modell, matrix="gamma") %>%
left_join(df, by=c("document"="id"))
#and we add the document to our new dataframe
names(corp_manif)```
As many had the issues, Max asked me to share my solution for merging the result of the model analysis with the original corpus in order to visualize it: