[R] How to partition sample space
Matthias Kirchner
sofa-surfer at web.de
Fri Jun 8 09:06:41 CEST 2007
Hi,
you could use the sample function:
sample<-sample(1:1000)
m.training<-m[sample[1:700],]
m.test<-m[sample[701:1000],]
Matthias
spime wrote:
>
> Hi R-users,
>
> I need your help in the following problem. Suppose we have a regression
> problem containing 25 predictor variables of 1000 individuals. I want to
> divide the data matrix ( 1000 x 25 ) into two partitions for training
> (70%) and testing(30%). For this reason, i sample 70% of data into another
> training matrix and remaining 30% into testing matrix using pseudorandom
> numbers (for future analysis).
>
> I need some efficient solution so that we can generate both matrix with
> minimal time.
>
> Thanks in advance.
>
> Sabyasachi
>
--
View this message in context: http://www.nabble.com/How-to-partition-sample-space-tf3888059.html#a11021527
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list