titanic <- read.csv("http://www.sumsar.net/files/titanic3.csv")
library(mosaic)
## Loading required package: grid
## Loading required package: car
## 
## Attaching package: 'mosaic'
## 
## The following object is masked from 'package:car':
## 
##     logit
## 
## The following object is masked from 'package:plyr':
## 
##     count
## 
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cov, D, fivenum, IQR, median, prop.test, sd,
##     t.test, var
## 
## The following objects are masked from 'package:base':
## 
##     max, mean, min, print, prod, range, sample, sum
titanic <- fetchData("http://www.sumsar.net/files/titanic3.csv")
## Complete file name given.  No searching necessary.
tally(~survived, data = titanic)
## 
##   0   1 
## 809 500
tally(~survived + pclass, data = titanic)
##         pclass
## survived   1   2   3
##        0 123 158 528
##        1 200 119 181
tally(~survived + sex, data = titanic)
##         sex
## survived female male
##        0    127  682
##        1    339  161

tally(~age == 17, data = titanic)
## 
##  TRUE FALSE 
##    20  1026
tally(~(age == 17 & sex == "female"), data = titanic)
## 
##  TRUE FALSE 
##     8  1223
tally(~(age == 17 & sex == "female" & pclass == 1), data = titanic)
## 
##  TRUE FALSE 
##     2  1296

tally(~(age == 20 & sex == "male" & pclass == 3 & survived == 1), data = titanic)
## 
##  TRUE FALSE 
##     4  1289