Using political blogs data as an example,
In a foreach loop, the following codes won't work, though it works perfectly fine outside foreach loop.
topics <- c(1:5)
prep <- estimateEffect(topics ~ rating, model_test, metadata = pol_topics_dfm$meta)
As a comparison, the following works in both
prep <- estimateEffect(1:5 ~ rating, model_test, metadata = pol_topics_dfm$meta)