I am trying to generate a random sample that excludes certain \"bad data.\" I do not know whether the data is \"bad\" until after I sample it. Thus, I need to make a rando
use this after your first sample
while (any(bad <- (x$SCORE <= 0))) x[bad, ] <- df[sample(nrow(df), sum(bad)), ]