```
# proportions
data(mtcars)
counts = table(mtcars$am, mtcars$vs)
props = prop.table(counts)
compare_proportions(props[,1], props[,2],
colSums(counts)[1], colSums(counts)[1])
# means
t.test(mpg ~ am, data = mtcars)$p.value
# the same result
with(mtcars,
compare_means(
mean(mpg[am==0]), mean(mpg[am==1]),
sd(mpg[am==0]), sd(mpg[am==1]),
length(mpg[am==0]), length(mpg[am==1])
))
```

Run the code above in your browser using DataCamp Workspace