Randomize-block-dataframe
stopifnot(nrow(df) %% N == 0) df <- df[order(runif(nrow(df))), ] bins <- rep(1:N, nrow(df) / N) split(df, bins)