> Given that clarification, I'd just generate the full set and remove > the ones you aren't interested in, as in: I'd agree; that is probably the most efficient thing to do with only half a dozen binary variables and a single condition.
A way of going about it for a more complex case might be to generate a single dummy variable encoding the special case combinations in the expand.grid step, and then decode that. For example (using this case): allowed.EF <- data.frame(E=c("pass", "pass", "fail"), F=c("pass", "fail", "pass" )) AtoEF <- expand.grid(A=c("pass", "fail"),B=c("pass", "fail"), C=c("pass", "fail"), D=c("pass", "fail"), EF=1:3 ) AtoF <- cbind(AtoEF[1:4], allowed.EF[AtoEF$EF,]) #Which gives the same combinations as Sarah's complete/subset method, albeit in a different order and with silly row names. ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.