I need to parallelize a while loop in R, in order to gain better performance. Is this always possible? In my case, I need to compute BTM models and their coherence in order to evaluate different models. THe loop is extremely simple:
while(i<=to)
{
row=row+1
df$Topic[row]<-i
BTM_model<-BTM(data=token, i)
df$MeanCoherence<-mean(coherenceBTM(model = BTM_model, DTM, N=15))
i=i+by
}
I don't wan this to seem like a homework, so just an explanation about how to implement this would be extremely useful!