Evgenia wrote: > Hello, > I have a matrix with 4000 rows and 8 columns with 1 and zeros > Every 1000 rows comes for a different rule, f1,f2,f3,f4. > > 1 1 1 1 0 0 0 0 > 1 1 1 1 0 0 0 0 > .... > 0 0 0 0 1 1 1 1 > 0 0 0 0 1 1 1 1 > ... > 1 1 0 0 1 1 0 0 > 1 1 0 0 1 1 0 0 > ... > 0 0 1 1 0 0 1 1 > 0 0 1 1 0 0 1 1 > > How can I extract 4 matrices each one containes 1000 elements from a certain > rule,since i want to > a) choose between f1, f2, f3 and f4 at random according to the > probabilities p1, p2, p3 ,p4 (it is assumed p1+p2+p3=1). > b) sample 1 value from whichever of f1, f2, f3 ,f4 was chosen
I guess we need some better explanations or examples - at least I do not understand your aims. Uwe Ligges > Thanks a lot > Evgenia > ______________________________________________ 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.