This is not what I want. I want to extract groups randomly from a data frame not the random rows from each subset.
For example,
xx <- rep(rep(seq(0,800,200),each=10),times=2)
yy<-c(replicate(2,sort(10^runif(10,-1,0),decreasing=TRUE)),replicate(2,sort(10^runif(10,-1,0),decreasing=TRUE)), replicate(2,sort(10^runif(10,-2,0),decreasing=TRUE)),replicate(2,sort(10^runif(10,-3,0),decreasing=TRUE)), replicate(2,sort(10^runif(10,-4,0), decreasing=TRUE)))
V <- rep(seq(100,2500,length.out=10),times=2)
No <- rep(1:10,each=10)
df <- data.frame(V,xx,yy,No)
library(dplyr)
random <- df %>%
group_by(No)%>%
sample_n(5,replace=T)