Using this commands it is possible to add for every document/row of the input data to which topic exist.
library(stm) library(tidyr) library(quanteda) testDfm