[R] Combinations of true/false values where one pair is mutually exclusive
S Ellison
S@E|||@on @end|ng |rom LGCGroup@com
Fri Aug 3 12:46:50 CEST 2018
> 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}}
More information about the R-help
mailing list