Mystery bug in sampling for loop in R I am trying to understand what is causing this bug in my R code and I feel like R is gaslighting me.