R/kablify.R

Defines functions kablify

Documented in kablify

#' Build a kable from a table, change proportions to
#' percentages
#'
#' @param tab
#'
#' @return
#' @export
#'
#' @examples
kablify <- function(tab) {

  tab %>%
    mutate_if(
      function(x) ifelse(is.factor(x), FALSE, is.numeric(x) & max(x) <= 1 & min(x) >= 0),
      scales::percent
    ) %>%
    knitr::kable(digits = 3)



}
blueprint-ade/bputils documentation built on June 10, 2018, 9:26 p.m.