Lets look at the distribution of survival by passenger class with a prop.table.

tab <- table(titanic$pclass, titanic$survival)
prop.table(tab, 1)
##         
##           Survived      Died
##   First  0.6191950 0.3808050
##   Second 0.4296029 0.5703971
##   Third  0.2552891 0.7447109

Ooh, that doesn’t look very good for third class. How about doing it as a figure?

Distribution of Titanic survival by gender

Distribution of Titanic survival by gender

Tables

Here is a kable style table.

Cross-tabulation of passenger class by survival on the Titanic
Survived Died
First 200 123
Second 119 158
Third 181 528

Here is a pandoc style table.

Cross-tabulation of passenger class by survival on the Titanic
  Survived Died
First 200 123
Second 119 158
Third 181 528

Tables for Regression Models

model1 <- lm(TomatoMeter~I(Runtime-90), data=movies)
model2 <- update(model1,.~.+Rating)
model3 <- update(model2,.~.+I(Runtime-90)*Rating)
model4 <- update(model3,.~.+I(Year-2001)+Genre+I(BoxOffice-mean(BoxOffice)))
knitreg(list(model1, model2, model3, model4),
        caption="Linear models predicting a movie's tomato meter rating",
        custom.coef.names = c("Intercept", "Movie runtime in minutes",
                              "PG", "PG-13","R",
                              "Runtime*PG", "Runtime*PG-13", "Runtime*R",
                              "Year of release",
                              "Animation","Comedy","Drama","Family","Horror",
                              "Musical","Mystery","Romance","Sci-Fi/Fantasy",
                              "Thriller","Box office returns (millions USD)"),
        digits = 3,
        caption.above=TRUE, 
        include.rsquared=TRUE,
        include.adjrs=FALSE,
        include.nobs=TRUE,
        include.rmse=FALSE)
Linear models predicting a movie’s tomato meter rating
Model 1 Model 2 Model 3 Model 4
Intercept 41.602*** 53.930*** 53.966*** 30.616***
(0.680) (3.326) (3.325) (4.334)
Movie runtime in minutes 0.405*** 0.443*** 0.398 0.310
(0.030) (0.030) (0.229) (0.222)
PG -12.870*** -12.618*** -6.353
(3.584) (3.685) (3.594)
PG-13 -18.776*** -20.945*** -1.848
(3.458) (3.512) (4.074)
R -8.437* -6.734 13.228**
(3.435) (3.476) (4.073)
Runtime*PG 0.015 0.148
(0.247) (0.235)
Runtime*PG-13 0.163 -0.018
(0.233) (0.224)
Runtime*R -0.069 -0.134
(0.233) (0.225)
Year of release 0.165
(0.128)
Animation 24.297***
(3.446)
Comedy 6.100**
(1.880)
Drama 18.890***
(2.128)
Family 9.851**
(3.109)
Horror -5.022*
(2.334)
Musical 11.901***
(2.861)
Mystery 10.500*
(4.138)
Romance 13.915***
(2.616)
Sci-Fi/Fantasy 2.982
(2.231)
Thriller 6.339**
(2.420)
Box office returns (millions USD) 0.095***
(0.009)
R2 0.067 0.104 0.108 0.204
Num. obs. 2553 2553 2553 2553
***p < 0.001; **p < 0.01; *p < 0.05