| Hao Zhu | 62cdde5 | 2017-05-20 22:16:03 -0400 | [diff] [blame] | 1 | % 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 Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 5 | \alias{pack_rows} | 
| Hao Zhu | 62cdde5 | 2017-05-20 22:16:03 -0400 | [diff] [blame] | 6 | \title{Put a few rows of a table into one category} | 
|  | 7 | \usage{ | 
| Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 8 | group_rows( | 
|  | 9 | kable_input, | 
|  | 10 | group_label = NULL, | 
|  | 11 | start_row = NULL, | 
|  | 12 | end_row = NULL, | 
|  | 13 | index = NULL, | 
| Hao Zhu | 76f0eb6 | 2018-09-15 12:38:33 -0400 | [diff] [blame] | 14 | label_row_css = "border-bottom: 1px solid;", | 
| Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 15 | 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 Zhu | 03e3333 | 2020-08-19 01:09:43 -0400 | [diff] [blame] | 25 | indent = TRUE, | 
|  | 26 | monospace = FALSE, | 
|  | 27 | underline = FALSE, | 
|  | 28 | strikeout = FALSE, | 
|  | 29 | color = NULL, | 
|  | 30 | background = NULL | 
| Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 31 | ) | 
| Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 32 |  | 
| Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 33 | pack_rows( | 
|  | 34 | kable_input, | 
|  | 35 | group_label = NULL, | 
|  | 36 | start_row = NULL, | 
|  | 37 | end_row = NULL, | 
|  | 38 | index = NULL, | 
| Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 39 | label_row_css = "border-bottom: 1px solid;", | 
| Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 40 | 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 Zhu | 03e3333 | 2020-08-19 01:09:43 -0400 | [diff] [blame] | 50 | indent = TRUE, | 
|  | 51 | monospace = FALSE, | 
|  | 52 | underline = FALSE, | 
|  | 53 | strikeout = FALSE, | 
|  | 54 | color = NULL, | 
|  | 55 | background = NULL | 
| Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 56 | ) | 
| Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 57 | } | 
|  | 58 | \arguments{ | 
| Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 59 | \item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified} | 
| Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 60 |  | 
|  | 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 | 
|  | 64 | group starts. Note that the counting excludes header rows and other group | 
|  | 65 | labeling rows} | 
|  | 66 |  | 
|  | 67 | \item{end_row}{A numeric value that tells the function in which row the group | 
|  | 68 | ends.} | 
|  | 69 |  | 
| Hao Zhu | 49483bf | 2017-09-12 11:21:00 -0400 | [diff] [blame] | 70 | \item{index}{A named vector providing the index for robust row-grouping tasks. | 
|  | 71 | Basically, you can use it in the same way as \code{add_header_above()}.} | 
|  | 72 |  | 
| Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 73 | \item{label_row_css}{A character string for any customized css used for the | 
|  | 74 | labeling row. By default, the labeling row will have a solid black line | 
|  | 75 | underneath. Only useful for HTML documents.} | 
|  | 76 |  | 
|  | 77 | \item{latex_gap_space}{A character value telling LaTeX how large the gap | 
|  | 78 | between the previous row and the group labeling row. Only useful for LaTeX | 
|  | 79 | documents.} | 
| Hao Zhu | ac7e70f | 2017-08-02 00:18:36 -0400 | [diff] [blame] | 80 |  | 
|  | 81 | \item{escape}{A T/F value showing whether special characters should be | 
|  | 82 | escaped.} | 
| Hao Zhu | 68b5bbf | 2018-03-26 11:30:34 -0400 | [diff] [blame] | 83 |  | 
|  | 84 | \item{latex_align}{Adjust justification of group_label in latex only. Value should be "c" for | 
|  | 85 | centered on row, "r" for right justification, or "l" for left justification. Default | 
|  | 86 | Value is "l"  If using html, the alignment can be set by using the label_row_css | 
|  | 87 | parameter.} | 
|  | 88 |  | 
| Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 89 | \item{latex_wrap_text}{T/F for wrapping long text. Default is off. Whenever | 
|  | 90 | it is turned on, the table will take up the entire line. It's recommended | 
|  | 91 | to use this with full_width in kable_styling.} | 
|  | 92 |  | 
| Hao Zhu | 68b5bbf | 2018-03-26 11:30:34 -0400 | [diff] [blame] | 93 | \item{colnum}{A numeric that determines how many columns the text should span. | 
|  | 94 | The 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 | 
|  | 101 | value is False.} | 
|  | 102 |  | 
|  | 103 | \item{hline_after}{A replicate of \code{hline.after} in xtable. It | 
|  | 104 | addes a hline after the row} | 
|  | 105 |  | 
|  | 106 | \item{extra_latex_after}{Extra LaTeX text to be added after the row.} | 
| Hao Zhu | 2742ffc | 2018-10-17 11:23:44 -0400 | [diff] [blame] | 107 |  | 
| Hao Zhu | 2b739ac | 2020-08-15 01:38:51 -0400 | [diff] [blame] | 108 | \item{indent}{A T/F value to control whether list items are indented.} | 
| Hao Zhu | 03e3333 | 2020-08-19 01:09:43 -0400 | [diff] [blame] | 109 |  | 
|  | 110 | \item{monospace}{T/F value to control whether the text of the | 
| Hao Zhu | 16d6619 | 2020-08-19 10:15:34 -0400 | [diff] [blame] | 111 | selected column need to be monospaced (verbatim)} | 
|  | 112 |  | 
|  | 113 | \item{underline}{T/F value to control whether the text of the | 
| Hao Zhu | 03e3333 | 2020-08-19 01:09:43 -0400 | [diff] [blame] | 114 | selected row need to be underlined} | 
|  | 115 |  | 
|  | 116 | \item{strikeout}{T/F value to control whether the text of the | 
|  | 117 | selected row need to be striked out.} | 
|  | 118 |  | 
|  | 119 | \item{color}{A character string for column text color. Here please | 
|  | 120 | pay attention to the differences in color codes between HTML and LaTeX.} | 
|  | 121 |  | 
|  | 122 | \item{background}{A character string for column background color. Here please | 
|  | 123 | pay attention to the differences in color codes between HTML and LaTeX.} | 
| Hao Zhu | 62cdde5 | 2017-05-20 22:16:03 -0400 | [diff] [blame] | 124 | } | 
|  | 125 | \description{ | 
| Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 126 | Group a few rows in a table together under a label. | 
| Hao Zhu | 62cdde5 | 2017-05-20 22:16:03 -0400 | [diff] [blame] | 127 | } | 
| Hao Zhu | 78e6122 | 2017-05-24 20:53:35 -0400 | [diff] [blame] | 128 | \examples{ | 
|  | 129 | x <- knitr::kable(head(mtcars), "html") | 
|  | 130 | # Put Row 2 to Row 5 into a Group and label it as "Group A" | 
| Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 131 | pack_rows(x, "Group A", 2, 5) | 
| Hao Zhu | 78e6122 | 2017-05-24 20:53:35 -0400 | [diff] [blame] | 132 |  | 
|  | 133 | } |