On 25 Oct 2005 at 13:48, Stephen Choularton wrote:
From: "Stephen Choularton" <[EMAIL PROTECTED]> To: "R Help" <r-help@stat.math.ethz.ch> Date sent: Tue, 25 Oct 2005 13:48:42 +1000 Subject: [R] selecting every nth item in the data > I want to make a glm and then use predict. I have a fairly small > sample (4000 cases) and I want to train on 90% and test on 10% but I > want to do it in slices so I test on every 10th case and train on the > others. Is there some simple way to get these elements? As glm accept subet you probably can use test<-seq(1,4000,n) glm(...., subset = test) to select only n'th item or glm(...., subset = -test) to select all but n'th items. or you can split the data freme by mydf[test,] or mydf[-test,] HTH Petr > > Stephen > > -- > > > > 21/10/2005 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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 Petr Pikal [EMAIL PROTECTED] ______________________________________________ R-help@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