[R] Combinations of true/false values where one pair is mutually exclusive

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu Aug 2 07:20:37 CEST 2018


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 using 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 using 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.




More information about the R-help mailing list