R/pretty_df.R

#' Pretty DataFrames
#'
#' Print DataFrame's in a pretty, compact way using Twitter's Bootstrap framework. By default the first five lines of the supplied, however, more lines can be printed if needed.
#' @param df DataFrame to be printed.
#' @param n The number of lines to be printed. Default=5.
#' @export
pretty_df <- function(df, n=5){
    basic_df <- knitr::kable(head(df, n=n))
    styled <- kableExtra::kable_styling(basic_df, bootstrap_options = c("striped", "condensed", "responsive"))
  return(styled)
}
thomaspinder/usefulRFunctions documentation built on May 10, 2019, 8:27 a.m.