Displaying 1 result from an estimated 1 matches for "createsets".
Did you mean:
createse
2012 Nov 04
1
sample equal number of cases per class
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 data
df <- data.frame(class = as.factor(sample(1:3, 20, replace = T)), var1 =
rnorm(20,3), var2 =