Hi,

May be this helps:

dat1 <- as.data.frame(matrix(1:(640*5), ncol=5,byrow=TRUE))

set.seed(41)

indx <-sample(nrow(dat1),nrow(dat1),replace=FALSE)

lst1 <- lapply(split(indx,as.numeric(gl(640,64,640))),function(x) dat1[x,])

A.K.

Dear all,

I have a data frame (d) composed of 640 observations for 55 variables.

I would like to randomly sample this data frame in 10 sub data frame of 64

observations for 55 variables. I dont want any of the observation to be in

more than one sub data-frame.

This code work for one sample

d1 <- d[sample(nrow(d),64,replace=F)

,]

This one give me a dataframe of 10 variable (each one is one sample...)

d1 <- replicate(10,sample(nrow(d),64,replace = F))

}

Can anyone help me ?

______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide

http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.