Skip to content

Instantly share code, notes, and snippets.

@andreagrioni
Created October 10, 2022 12:22
Show Gist options
  • Save andreagrioni/26ead2a295af92ccea5b64566f86fd8d to your computer and use it in GitHub Desktop.
Save andreagrioni/26ead2a295af92ccea5b64566f86fd8d to your computer and use it in GitHub Desktop.
library(DT)
#' render_dt
#' render a DT table within Rmarkdown.
#' @param table a data frame
render_dt <- function(table) {
table %>%
DT::datatable(
extensions = 'Buttons',
options = list(dom = 'Blfrtip', scrollX = TRUE, scrollY=TRUE,
buttons = c('copy', 'csv'),
lengthMenu = list(c(10,25,50,-1),
c(10,25,50,"All"))))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment