Dear Dan, On Thu, Sep 17, 2009 at 5:31 PM, Erik Iverson <eiver...@nmdp.org> wrote: > Dan, > > Still maybe a bit ugly, but no looping... > >> unique(as.data.frame(t(apply(expand.grid(0:2, 0:2, 0:2), 1, sort))))
The prob package provides a convenience wrapper for (essentially) Erik's solution: library(prob) urnsamples(0:2, size = 3, replace = TRUE, ordered = FALSE) Regards, Jay *************************************************** G. Jay Kerns, Ph.D. Associate Professor Department of Mathematics & Statistics Youngstown State University Youngstown, OH 44555-0002 USA Office: 1035 Cushwa Hall Phone: (330) 941-3310 Office (voice mail) -3302 Department -3170 FAX VoIP: gjke...@ekiga.net E-mail: gke...@ysu.edu http://www.cc.ysu.edu/~gjkerns/ ______________________________________________ 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.