Learn R Programming

tablet (version 0.2.7)

as_kable.tablet: Coerce Tablet to Kable

Description

Renders a tablet. Calls kbl and implements special features like grouped columns.

Usage

# S3 method for tablet
as_kable(
  x,
  ...,
  booktabs = TRUE,
  escape = FALSE,
  escape_latex = function(x, ...) gsub("%", "\\\\%", x),
  escape_html = function(x, ...) x,
  variable = " ",
  col.names = NA,
  linebreak = TRUE,
  align = "c",
  double_escape = FALSE,
  linebreaker = "\n",
  pack_rows = list()
)

Arguments

...

passed to kbl

booktabs

passed to kbl

escape

passed to kbl; defaults FALSE to allow header linebreaks

escape_latex

a function to pre-process column content if 'escape' is FALSE (e.g., manual escaping, latex only)

escape_html

a function to pre-process column content if 'escape' is FALSE (e.g., manual escaping, html only)

variable

a column name for the variables

col.names

passed to kbl after any linebreaking

linebreak

whether to invoke linebreak for column names

align

passed to linebreak for column names

double_escape

passed to linebreak for column names

linebreaker

passed to linebreak for column names in latex; for html, newline is replaced with <br>

pack_rows

named list passed to pack_rows for finer control of variable names

Value

like kbl

Examples

Run this code
# NOT RUN {
library(boot)
library(dplyr)
library(magrittr)
melanoma %>%
  select(-time, -year) %>%
  mutate(sex = factor(sex), ulcer = factor(ulcer)) %>%
  group_by(status) %>%
  tablet %>%
  as_kable
# }

Run the code above in your browser using DataLab