3.11 outTable

This function will output a simple table nicely in any of the main R Markdown output formats, including bookdown.

Arguments:

  • to_indent row indices specifying a small indent in the first column
  • to_bold row indices specifying which rows to bold
  • caption a caption to print above the table.
library(janitor)
tab <- lung %>% tabyl(Status,Sex)
outTable(tab, 
         to_indent=1,
         to_bold=2,
         caption= 'Status by Sex in the Lung data' )
Table 3.3: Status by Sex in the Lung data
Status Female Male NA_
0 36 24 3
1 50 108 7