Skip to content
Prev 170108 / 398506 Next

Beginner-how to down size a large sample

On Wed, Feb 11, 2009 at 3:15 PM, pramil cheriyath <drpramil at gmail.com> wrote:
dataSet<-data.frame(group=sample(c(1,0),10000,replace=T),data=rnorm(10000))
dataSet.1<-dataSet[dataSet$group==1,]
dataSet.0<-dataSet[dataSet$group==0,]
sampled.1<-dataSet.1[sample(1:nrow(dataSet.1),100),]
sampled.0<-dataSet.0[sample(1:nrow(dataSet.0),100),]

newdataSet<-rbind(sampled.1,sampled.0)

/Gustaf
(a "please", would have been nice....)