The (amazing) stm package contains several functions for selecting the optimal number of topics in a topic model (k). Two of these functions are
stm