R/print_table.R

Defines functions present_table

Documented in present_table

#' Present a stylish table
#' 
#' @description Creates a formatted and styled table to display COVID19 data using the kableExtra package
#'
#' @param data The data set to be formatted
#' @param measure The measure chosen for the heading of the table as a character vector, can be `"cases"` or `"deaths"`
#' @param caption The desired caption for the table entered as a character string.
#' 
#' @return A formatted kable of the original data set entered
#' 
#' @importFrom magrittr %>%
#' 
#' @export
#'
#' 
present_table <- function(data, measure, caption){
  data %>%
    kableExtra::kable(digits = 0,
                      format.args = list(big.mark = ","),
                      caption = caption,
                      format = "html",
                      escape = FALSE) %>%
    kableExtra::row_spec(0,background = "black") %>%
    kableExtra::kable_styling(bootstrap_options = c("border"))%>%
    kableExtra::scroll_box(height = "500px")
}
etc5523-2020/r-package-assessment-AbhishekSinha28 documentation built on Jan. 1, 2021, 1:09 a.m.