library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
possibilities_vector <- expand.grid(rep(list(c("m","f"),c("Mon", "Tue", "Wed","Thur", "Fri", "Sat", "Sun" )), 2))%>%
  rename( "first_child_sex" = Var1, "first_child_day" = Var2 ,  "second_child_sex" = Var3 , "second_child_day"= Var4)
possibilities_vector%>%
  filter((first_child_sex == "m" & first_child_day == "Tue") | (second_child_sex == "m" & second_child_day == "Tue"))%>%
    mutate(check_prop = 
      case_when(
        first_child_sex == "m" & second_child_sex == "m" ~ "success",
        T~ "failure"
      ))%>%group_by(check_prop)%>%
        tally()%>%pivot_wider(names_from = check_prop, values_from = n)%>%
        mutate(total = failure + success)%>%
        mutate(rate = success / total)
possibilities_vector%>% filter(first_child_sex == "m" | second_child_sex =="m" )%>%mutate(check_prop = 
      case_when(
        first_child_sex == "m" & second_child_sex == "m" ~ "success",
        T~ "failure"
      ))%>%group_by(check_prop)%>%
        tally()%>%pivot_wider(names_from = check_prop, values_from = n)%>%
        mutate(total = failure + success)%>%
        mutate(rate = success / total)