blob: db032f5d11d805b6d40b37d9aa579c9d4eef3915 [file] [log] [blame]
Hao Zhu62cdde52017-05-20 22:16:03 -04001% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/group_rows.R
3\name{group_rows}
4\alias{group_rows}
Hao Zhu72917f92019-03-15 18:41:42 -04005\alias{pack_rows}
Hao Zhu62cdde52017-05-20 22:16:03 -04006\title{Put a few rows of a table into one category}
7\usage{
Hao Zhu49483bf2017-09-12 11:21:00 -04008group_rows(kable_input, group_label = NULL, start_row = NULL,
9 end_row = NULL, index = NULL,
Hao Zhu76f0eb62018-09-15 12:38:33 -040010 label_row_css = "border-bottom: 1px solid;",
11 latex_gap_space = "0.3em", escape = TRUE, latex_align = "l",
Hao Zhu2742ffc2018-10-17 11:23:44 -040012 colnum = NULL, bold = TRUE, italic = FALSE, hline_before = FALSE,
13 hline_after = FALSE, extra_latex_after = NULL, indent = TRUE)
Hao Zhu72917f92019-03-15 18:41:42 -040014
15pack_rows(kable_input, group_label = NULL, start_row = NULL,
16 end_row = NULL, index = NULL,
17 label_row_css = "border-bottom: 1px solid;",
18 latex_gap_space = "0.3em", escape = TRUE, latex_align = "l",
19 colnum = NULL, bold = TRUE, italic = FALSE, hline_before = FALSE,
20 hline_after = FALSE, extra_latex_after = NULL, indent = TRUE)
Hao Zhubd95bb22017-05-22 16:08:49 -040021}
22\arguments{
Hao Zhu76281fe2017-07-03 19:33:09 -040023\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
Hao Zhubd95bb22017-05-22 16:08:49 -040024
25\item{group_label}{A character string for the name of the group}
26
27\item{start_row}{A numeric value that tells the function in which row the
28group starts. Note that the counting excludes header rows and other group
29labeling rows}
30
31\item{end_row}{A numeric value that tells the function in which row the group
32ends.}
33
Hao Zhu49483bf2017-09-12 11:21:00 -040034\item{index}{A named vector providing the index for robust row-grouping tasks.
35Basically, you can use it in the same way as \code{add_header_above()}.}
36
Hao Zhubd95bb22017-05-22 16:08:49 -040037\item{label_row_css}{A character string for any customized css used for the
38labeling row. By default, the labeling row will have a solid black line
39underneath. Only useful for HTML documents.}
40
41\item{latex_gap_space}{A character value telling LaTeX how large the gap
42between the previous row and the group labeling row. Only useful for LaTeX
43documents.}
Hao Zhuac7e70f2017-08-02 00:18:36 -040044
45\item{escape}{A T/F value showing whether special characters should be
46escaped.}
Hao Zhu68b5bbf2018-03-26 11:30:34 -040047
48\item{latex_align}{Adjust justification of group_label in latex only. Value should be "c" for
49centered on row, "r" for right justification, or "l" for left justification. Default
50Value is "l" If using html, the alignment can be set by using the label_row_css
51parameter.}
52
53\item{colnum}{A numeric that determines how many columns the text should span.
54The default setting will have the text span the entire length.}
55
56\item{bold}{A T/F value to control whether the text should be bolded.}
57
58\item{italic}{A T/F value to control whether the text should to be emphasized.}
59
60\item{hline_before}{A T/F value that addes a horizontal line before the group_row label. Default
61value is False.}
62
63\item{hline_after}{A replicate of \code{hline.after} in xtable. It
64addes a hline after the row}
65
66\item{extra_latex_after}{Extra LaTeX text to be added after the row.}
Hao Zhu2742ffc2018-10-17 11:23:44 -040067
68\item{indent}{A T?F value to control whether list items are indented.}
Hao Zhu62cdde52017-05-20 22:16:03 -040069}
70\description{
Hao Zhubd95bb22017-05-22 16:08:49 -040071Group a few rows in a table together under a label.
Hao Zhu62cdde52017-05-20 22:16:03 -040072}
Hao Zhu78e61222017-05-24 20:53:35 -040073\examples{
74x <- knitr::kable(head(mtcars), "html")
75# Put Row 2 to Row 5 into a Group and label it as "Group A"
Hao Zhu72917f92019-03-15 18:41:42 -040076pack_rows(x, "Group A", 2, 5)
Hao Zhu78e61222017-05-24 20:53:35 -040077
78}