[BioC] Cross validation

Ido M. Tamir tamir at imp.univie.ac.at
Mon Aug 13 12:34:02 CEST 2007


On Monday 13 August 2007 04:25, Li Xiao wrote:
> Hi ALL,
>
>    How to randomly divide my sample (a data.frame) into ten separate equal
> sets for cross validation?
>
> Thanks
> LiXiao

sz <- 10
df <- data.frame(label=1:100,score=rnorm(100))
dfrand <- df[sample(1:nrow(df)),]
dfsplit <- split(dfrand,rep(1:sz,nrow(df)/sz))

best wishes
ido



More information about the Bioconductor mailing list