blob: 1bcb78a83a7fafeee18cab5e2ce784b12ddc582e [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
111selected column need to be monospaced (verbatim)
112#' @param underline T/F value to control whether the text of the
113selected row need to be underlined}
114
115\item{strikeout}{T/F value to control whether the text of the
116selected row need to be striked out.}
117
118\item{color}{A character string for column text color. Here please
119pay attention to the differences in color codes between HTML and LaTeX.}
120
121\item{background}{A character string for column background color. Here please
122pay attention to the differences in color codes between HTML and LaTeX.}
Hao Zhu62cdde52017-05-20 22:16:03 -0400123}
124\description{
Hao Zhubd95bb22017-05-22 16:08:49 -0400125Group a few rows in a table together under a label.
Hao Zhu62cdde52017-05-20 22:16:03 -0400126}
Hao Zhu78e61222017-05-24 20:53:35 -0400127\examples{
128x <- knitr::kable(head(mtcars), "html")
129# Put Row 2 to Row 5 into a Group and label it as "Group A"
Hao Zhu72917f92019-03-15 18:41:42 -0400130pack_rows(x, "Group A", 2, 5)
Hao Zhu78e61222017-05-24 20:53:35 -0400131
132}