Re: [R] Sampling with Constraints for testing and training data

2012-01-25 Thread Petr Savicky
On Wed, Jan 25, 2012 at 04:00:27AM -0800, Eliano wrote: > Hi People, > > Does anyone have a good solution for this problem: > > a database called DB. > > > index <- sample(1:nrow(DB), size=0.2*nrow(BD)) > test <- DB[index,] > train <- DB[-index,] > > One of the variables in this database

Re: [R] Sampling with Constraints for testing and training data

2012-01-25 Thread Eliano
Hi People, Does anyone have a good solution for this problem: a database called DB. index <- sample(1:nrow(DB), size=0.2*nrow(BD)) test <- DB[index,] train <- DB[-index,] One of the variables in this database contais a target variable with two values 0 and 1. Imagine now that i want to