blob: 43094a6d88d082e943dd37e25c0657450d374dab [file] [log] [blame]
Hao Zhu96a50b52017-06-14 18:09:35 -04001% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/add_header_left.R
3\name{add_header_left}
4\alias{add_header_left}
Hao Zhu4f10f652017-06-16 14:03:44 -04005\title{Add a heading column to the left side of the table}
Hao Zhu96a50b52017-06-14 18:09:35 -04006\usage{
Hao Zhu4f10f652017-06-16 14:03:44 -04007add_header_left(kable_input, header = NULL, header_name = "", align = "c",
Hao Zhubf5bfe22017-06-21 14:37:41 -04008 width = NULL, bold = F, italic = F, ...)
Hao Zhu4f10f652017-06-16 14:03:44 -04009}
10\arguments{
11\item{kable_input}{Output of `knitr::kable()` with `format` specified}
12
13\item{header}{A (named) character vector with `rowspan` as values. For
14example, `c("xxx" = 1, "title" = 2)` can be used to create a new header column
15for a 3-row table with "xxx" spanning row 1 and "title" spanning row 2 & 3 (
16two rows). For convenience, when `rowspan` equals to 1, users can drop the
17` = 1` part. As a result, `c("xxx", "title" = 2)` is the same as
18`c("xxx" = 1, "title" = 2)`.}
19
20\item{header_name}{Column name that that extra column}
21
22\item{align}{Column alignment. you can choose from "c", "l" or "r"}
23
Hao Zhu32f43f72017-06-20 18:24:54 -040024\item{width}{A character string for the width of the new column. Values
25could be "10cm", "3in" or "30em", etc..}
26
27\item{bold}{A T/F value to control whether the text should be bolded.}
28
29\item{italic}{A T/F value to control whether the text should to be emphasized.}
30
Hao Zhubf5bfe22017-06-21 14:37:41 -040031\item{...}{Extra options to be passed into HTML or LaTeX. Right now there is
32only one for LaTeX. Option full_midline is a TRUE/FALSE option to control
33if the mid line needs to be extended to the end of row.}
Hao Zhu96a50b52017-06-14 18:09:35 -040034}
35\description{
Hao Zhu4f10f652017-06-16 14:03:44 -040036This function uses the same syntax as add_header_above. It will
37add a heading column with grouped rows to the left side of the table. It can
38act as an alternative way to `group_rows` to show grouped information. As
39`add_header_above`, users can use this function to add multiple layers of
40heading columns one by one.
Hao Zhu96a50b52017-06-14 18:09:35 -040041}
Hao Zhu5a7689e2017-06-26 15:37:24 -100042\examples{
43x <- knitr::kable(head(mtcars), "html")
44add_header_left(x, c("A" = 2, "B" = 2, "C" = 2))
Hao Zhu5a7689e2017-06-26 15:37:24 -100045}