# http://news.bbc.co.uk/2/hi/programmes/more_or_less/8735812.stm one_child <- expand.grid( sex=c("Boy", "Girl"), wday=c("Mo", "Tue", "We", "Th", "Fr", "Sa", "Su") ) |> transform(sex_wday=paste(sex, "-", wday)) |> subset(select="sex_wday") |> unlist() |> unname() two_children <- expand.grid(first=one_child, second=one_child, stringsAsFactors=FALSE) |> transform( tuesday_boy=grepl("Boy - Tue", first) | grepl("Boy - Tue", second), two_boys=grepl("Boy", first) & grepl("Boy", second) ) sum(two_children$tuesday_boy & two_children$two_boys) / sum(two_children$tuesday_boy)