sampledat<-function(dat,size){ N<-dim(dat)[1] sinds<-sample(1:N,size) sampl<-dat[sinds,] return(sampl) }