R Stafford
2018-Aug-02 01:20 UTC
[R] Combinations of true/false values where one pair is mutually exclusive
I have 6 variables, (A,B,C,D,E,F) that can either pass or fail (i.e., true or false). I can get a table of all pass/fail combinations with this: scenarios <- expand.grid(A = c("pass", "fail"), B = c("pass", "fail"), C c("pass", "fail"), D = c("pass", "fail"), E = c("pass", "fail"), F c("pass", "fail")) But I have the extra condition that if E is true, then F must be false, and vice versa, so what I don't know is how to get all combinations when E and F are mutually exclusive. [[alternative HTML version deleted]]
Jim Lemon
2018-Aug-02 05:20 UTC
[R] Combinations of true/false values where one pair is mutually exclusive
Hi Rod, How about this? scenarios <- expand.grid(A = c("pass", "fail"), B = c("pass", "fail"), C c("pass", "fail"), D = c("pass", "fail"), E = c("pass", "fail")) scenarios$F<-ifelse(scenarios$E=="pass","fail","pass") Jim On Thu, Aug 2, 2018 at 11:20 AM, R Stafford <rod.stafford at gmail.com> wrote:> I have 6 variables, (A,B,C,D,E,F) that can either pass or fail (i.e., true > or false). > I can get a table of all pass/fail combinations with this: > > scenarios <- expand.grid(A = c("pass", "fail"), B = c("pass", "fail"), C > c("pass", "fail"), D = c("pass", "fail"), E = c("pass", "fail"), F > c("pass", "fail")) > > But I have the extra condition that if E is true, then F must be false, and > vice versa, so what I don't know is how to get all combinations when E and F > are mutually exclusive. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
S Ellison
2018-Aug-02 11:26 UTC
[R] Combinations of true/false values where one pair is mutually exclusive
> On Thu, Aug 2, 2018 at 11:20 AM, R Stafford <rod.stafford at gmail.com> > wrote: > > But I have the extra condition that if E is true, then F must be false, and > > vice versa,Question: Does 'vice versa' mean a) "if E is False, F must be True" or b) "if F is True, E must be False"? ... which are not the same. b) (and mutual exclusivity in general) does not rule out the condition "E False, F False", which would not be addressed by the pass/fail equivalent equivalent of F <- !E ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}