blob: 5dd2b7c8faa8af52a95def13eaf4ebf10786b620 [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 Zhu9410a272020-08-03 01:11:47 -04008group_rows(
9 kable_input,
10 group_label = NULL,
11 start_row = NULL,
12 end_row = NULL,
13 index = NULL,
Hao Zhu76f0eb62018-09-15 12:38:33 -040014 label_row_css = "border-bottom: 1px solid;",
Hao Zhu9410a272020-08-03 01:11:47 -040015 latex_gap_space = "0.3em",
16 escape = TRUE,
17 latex_align = "l",
18 latex_wrap_text = FALSE,
19 colnum = NULL,
20 bold = TRUE,
21 italic = FALSE,
22 hline_before = FALSE,
23 hline_after = FALSE,
24 extra_latex_after = NULL,
Hao Zhu03e33332020-08-19 01:09:43 -040025 indent = TRUE,
26 monospace = FALSE,
27 underline = FALSE,
28 strikeout = FALSE,
29 color = NULL,
30 background = NULL
Hao Zhu9410a272020-08-03 01:11:47 -040031)
Hao Zhu72917f92019-03-15 18:41:42 -040032
Hao Zhu9410a272020-08-03 01:11:47 -040033pack_rows(
34 kable_input,
35 group_label = NULL,
36 start_row = NULL,
37 end_row = NULL,
38 index = NULL,
Hao Zhu72917f92019-03-15 18:41:42 -040039 label_row_css = "border-bottom: 1px solid;",
Hao Zhu9410a272020-08-03 01:11:47 -040040 latex_gap_space = "0.3em",
41 escape = TRUE,
42 latex_align = "l",
43 latex_wrap_text = FALSE,
44 colnum = NULL,
45 bold = TRUE,
46 italic = FALSE,
47 hline_before = FALSE,
48 hline_after = FALSE,
49 extra_latex_after = NULL,
Hao Zhu03e33332020-08-19 01:09:43 -040050 indent = TRUE,
51 monospace = FALSE,
52 underline = FALSE,
53 strikeout = FALSE,
54 color = NULL,
55 background = NULL
Hao Zhu9410a272020-08-03 01:11:47 -040056)
Hao Zhubd95bb22017-05-22 16:08:49 -040057}
58\arguments{
Hao Zhu76281fe2017-07-03 19:33:09 -040059\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
Hao Zhubd95bb22017-05-22 16:08:49 -040060
61\item{group_label}{A character string for the name of the group}
62
63\item{start_row}{A numeric value that tells the function in which row the
64group starts. Note that the counting excludes header rows and other group
65labeling rows}
66
67\item{end_row}{A numeric value that tells the function in which row the group
68ends.}
69
Hao Zhu49483bf2017-09-12 11:21:00 -040070\item{index}{A named vector providing the index for robust row-grouping tasks.
71Basically, you can use it in the same way as \code{add_header_above()}.}
72
Hao Zhubd95bb22017-05-22 16:08:49 -040073\item{label_row_css}{A character string for any customized css used for the
74labeling row. By default, the labeling row will have a solid black line
75underneath. Only useful for HTML documents.}
76
77\item{latex_gap_space}{A character value telling LaTeX how large the gap
78between the previous row and the group labeling row. Only useful for LaTeX
79documents.}
Hao Zhuac7e70f2017-08-02 00:18:36 -040080
81\item{escape}{A T/F value showing whether special characters should be
82escaped.}
Hao Zhu68b5bbf2018-03-26 11:30:34 -040083
84\item{latex_align}{Adjust justification of group_label in latex only. Value should be "c" for
85centered on row, "r" for right justification, or "l" for left justification. Default
86Value is "l" If using html, the alignment can be set by using the label_row_css
87parameter.}
88
Hao Zhu9410a272020-08-03 01:11:47 -040089\item{latex_wrap_text}{T/F for wrapping long text. Default is off. Whenever
90it is turned on, the table will take up the entire line. It's recommended
91to use this with full_width in kable_styling.}
92
Hao Zhu68b5bbf2018-03-26 11:30:34 -040093\item{colnum}{A numeric that determines how many columns the text should span.
94The default setting will have the text span the entire length.}
95
96\item{bold}{A T/F value to control whether the text should be bolded.}
97
98\item{italic}{A T/F value to control whether the text should to be emphasized.}
99
100\item{hline_before}{A T/F value that addes a horizontal line before the group_row label. Default
101value is False.}
102
103\item{hline_after}{A replicate of \code{hline.after} in xtable. It
104addes a hline after the row}
105
106\item{extra_latex_after}{Extra LaTeX text to be added after the row.}
Hao Zhu2742ffc2018-10-17 11:23:44 -0400107
Hao Zhu2b739ac2020-08-15 01:38:51 -0400108\item{indent}{A T/F value to control whether list items are indented.}
Hao Zhu03e33332020-08-19 01:09:43 -0400109
110\item{monospace}{T/F value to control whether the text of the
Hao Zhu16d66192020-08-19 10:15:34 -0400111selected column need to be monospaced (verbatim)}
112
113\item{underline}{T/F value to control whether the text of the
Hao Zhu03e33332020-08-19 01:09:43 -0400114selected row need to be underlined}
115
116\item{strikeout}{T/F value to control whether the text of the
117selected row need to be striked out.}
118
119\item{color}{A character string for column text color. Here please
120pay attention to the differences in color codes between HTML and LaTeX.}
121
122\item{background}{A character string for column background color. Here please
123pay attention to the differences in color codes between HTML and LaTeX.}
Hao Zhu62cdde52017-05-20 22:16:03 -0400124}
125\description{
Hao Zhubd95bb22017-05-22 16:08:49 -0400126Group a few rows in a table together under a label.
Hao Zhu62cdde52017-05-20 22:16:03 -0400127}
Hao Zhu78e61222017-05-24 20:53:35 -0400128\examples{
Hao Zhu9399dcc2020-08-26 17:27:38 -0400129\dontrun{
Hao Zhu78e61222017-05-24 20:53:35 -0400130x <- knitr::kable(head(mtcars), "html")
131# Put Row 2 to Row 5 into a Group and label it as "Group A"
Hao Zhu72917f92019-03-15 18:41:42 -0400132pack_rows(x, "Group A", 2, 5)
Hao Zhu9399dcc2020-08-26 17:27:38 -0400133}
Hao Zhu78e61222017-05-24 20:53:35 -0400134
135}