Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df1 <- data.frame(a=rep(1:3, each=9), b=rep(1:3, each=3), c=rep(1:9, times=3))
- df2 <- do.call(rbind, lapply(split(df1, list(df1$b, df1$a)) ,
- function(df1) df1[sample(nrow(df1), ) , ]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement