Hi, Thanks all for your responses, but as I m a new user of R while trying to apply what David suggests I dont know what *"dorm" *refers to.
dfrm[c(rownames(dfrm[*dorm*$Y==1,]), sample(rownames(dfrm[dfrm$Y==0]), 0.10)) , ] But to give you more details , I'm working on a table calles balance from UCI machine learning I do have a variable called class and takes 3 values : B, L and R. B represents 8% of the total and L and R 46% each one. The purpose is to have a data set with 10% of B, 40% of L and 40% of R. Thank u -- View this message in context: http://r.789695.n4.nabble.com/oversampling-code-tp3956664p3964240.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.