Skip to content

Instantly share code, notes, and snippets.

@rmflight
Created October 31, 2019 14:02
Show Gist options
  • Save rmflight/7590e8529475139b2004bfa91942c926 to your computer and use it in GitHub Desktop.
Save rmflight/7590e8529475139b2004bfa91942c926 to your computer and use it in GitHub Desktop.
creates a smaller table
smaller_latex_table = function(kable_table, size = "tiny"){
split_table = strsplit(kable_table, "\n", )[[1]]
centering_loc = grepl("centering", split_table)
top_table = split_table[seq(1, which(centering_loc))]
bottom_table = split_table[seq(which(centering_loc)+1, length(split_table))]
new_table = c(top_table,
paste0("\\", size),
bottom_table)
structure(new_table, format = "latex", class = "knitr_kable")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment