9 Generate APA-style table for frequency tables

frequency_tables %>%
  kable(caption = "Frequency Tables for Categorical Variables",
        col.names = c("Variable", "Category", "Count", "Percentage"),
        format = "html") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"),
                full_width = FALSE,
                position = "left") %>%
  add_header_above(c(" " = 2, "Frequency Table" = 2)) %>%
  footnote(general = "Note. This table presents the frequency and percentage of categories for zygosity and sex in the twin dataset.",
           general_title = " ",
           footnote_as_chunk = TRUE)
Table 9.1: Frequency Tables for Categorical Variables
Frequency Table
Variable Category Count Percentage
sex F 3966 52.07
sex M 1838 24.13
sex OS 1812 23.79
zyg DZ 4018 52.76
zyg MZ 3598 47.24
Note. This table presents the frequency and percentage of categories for zygosity and sex in the twin dataset.