[R] Re : How to partition sample space

From: justin bem <justin_bem_at_yahoo.fr>
Date: Fri, 08 Jun 2007 09:44:48 +0000 (GMT)


also try

active.sample<-sample(1:1000,n=700)
active.df<-thedf[active.sample, ]

   test.df<-thedf[-active.sample, ]  

Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

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.

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.









      
	
		
___________________________________________________________________________





	[[alternative HTML version deleted]]


______________________________________________ R-help_at_stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Received on Fri 08 Jun 2007 - 10:17:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Jun 2007 - 10:31:47 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.