RE: [R] calibration/validation sets

2004-08-14 Thread Austin, Matt
You could keep a row index vector like in the following example. data(iris) indx - sample(nrow(iris), 20, replace=FALSE) train - iris[indx,] test - iris[-indx,] --Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Peyuco Porras Porras . Sent:

Re: [R] calibration/validation sets

2004-08-14 Thread Kevin Wang
Hi, On Sat, 14 Aug 2004, Peyuco Porras Porras . wrote: Hi; Does anyone know how to create a calibration and validation set from a particular dataset? I have a dataframe with nearly 20,000 rows! and I would like to select (randomly) a subset from the original dataset (...I found how to do

RE: [R] calibration/validation sets

2004-08-14 Thread Liaw, Andy
There are many ways to do this. One example, supposing your data is in `myData': ## randomly pick 1/3 for validation: valid.idx - sample(nrow(myData), round(nrow(myData)/3), replace=FALSE) ## training set: myData.tr - myData[-valid.idx,] ## validation set: myData.valid - myData[valid.idx,]