powered by
sampledf(df, size, replace = FALSE, sortby = "")
df <- expand.grid(a=0:1, b=0:1, c=0:1) df$count <- rpois(nrow(df), 5) df2 <- expanddf(df, df$count) ( df3 <- sampledf(df2, size=5, replace=FALSE, sortby='c') )
Run the code above in your browser using DataLab