Re: [R] sample equal number of cases per class

2012-11-04 Thread Rui Barradas
Hello, Function caret::createDatapartition preserves the proportions of classes, like its documentation says, so you should expected the result to be balanced only if the original data.frame is also balanced. A solution is to write a small function that chooses a balanced set of indices. Note

[R] sample equal number of cases per class

2012-11-04 Thread ollestrat
Dear community I have a dataframe and want to split it into a learn and a test partition. However the learnset should be balanced, i.e. each class should have the same number of cases. I tried and searched a lot, without success so far. Maybe you can help? Some example code *# generate example da