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, |
| 25 | indent = TRUE |
| 26 | ) |
Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 27 | |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 28 | pack_rows( |
| 29 | kable_input, |
| 30 | group_label = NULL, |
| 31 | start_row = NULL, |
| 32 | end_row = NULL, |
| 33 | index = NULL, |
Hao Zhu | 72917f9 | 2019-03-15 18:41:42 -0400 | [diff] [blame] | 34 | label_row_css = "border-bottom: 1px solid;", |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 35 | latex_gap_space = "0.3em", |
| 36 | escape = TRUE, |
| 37 | latex_align = "l", |
| 38 | latex_wrap_text = FALSE, |
| 39 | colnum = NULL, |
| 40 | bold = TRUE, |
| 41 | italic = FALSE, |
| 42 | hline_before = FALSE, |
| 43 | hline_after = FALSE, |
| 44 | extra_latex_after = NULL, |
| 45 | indent = TRUE |
| 46 | ) |
Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 47 | } |
| 48 | \arguments{ |
Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 49 | \item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified} |
Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 50 | |
| 51 | \item{group_label}{A character string for the name of the group} |
| 52 | |
| 53 | \item{start_row}{A numeric value that tells the function in which row the |
| 54 | group starts. Note that the counting excludes header rows and other group |
| 55 | labeling rows} |
| 56 | |
| 57 | \item{end_row}{A numeric value that tells the function in which row the group |
| 58 | ends.} |
| 59 | |
Hao Zhu | 49483bf | 2017-09-12 11:21:00 -0400 | [diff] [blame] | 60 | \item{index}{A named vector providing the index for robust row-grouping tasks. |
| 61 | Basically, you can use it in the same way as \code{add_header_above()}.} |
| 62 | |
Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 63 | \item{label_row_css}{A character string for any customized css used for the |
| 64 | labeling row. By default, the labeling row will have a solid black line |
| 65 | underneath. Only useful for HTML documents.} |
| 66 | |
| 67 | \item{latex_gap_space}{A character value telling LaTeX how large the gap |
| 68 | between the previous row and the group labeling row. Only useful for LaTeX |
| 69 | documents.} |
Hao Zhu | ac7e70f | 2017-08-02 00:18:36 -0400 | [diff] [blame] | 70 | |
| 71 | \item{escape}{A T/F value showing whether special characters should be |
| 72 | escaped.} |
Hao Zhu | 68b5bbf | 2018-03-26 11:30:34 -0400 | [diff] [blame] | 73 | |
| 74 | \item{latex_align}{Adjust justification of group_label in latex only. Value should be "c" for |
| 75 | centered on row, "r" for right justification, or "l" for left justification. Default |
| 76 | Value is "l" If using html, the alignment can be set by using the label_row_css |
| 77 | parameter.} |
| 78 | |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 79 | \item{latex_wrap_text}{T/F for wrapping long text. Default is off. Whenever |
| 80 | it is turned on, the table will take up the entire line. It's recommended |
| 81 | to use this with full_width in kable_styling.} |
| 82 | |
Hao Zhu | 68b5bbf | 2018-03-26 11:30:34 -0400 | [diff] [blame] | 83 | \item{colnum}{A numeric that determines how many columns the text should span. |
| 84 | The default setting will have the text span the entire length.} |
| 85 | |
| 86 | \item{bold}{A T/F value to control whether the text should be bolded.} |
| 87 | |
| 88 | \item{italic}{A T/F value to control whether the text should to be emphasized.} |
| 89 | |
| 90 | \item{hline_before}{A T/F value that addes a horizontal line before the group_row label. Default |
| 91 | value is False.} |
| 92 | |
| 93 | \item{hline_after}{A replicate of \code{hline.after} in xtable. It |
| 94 | addes a hline after the row} |
| 95 | |
| 96 | \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] | 97 | |
| 98 | \item{indent}{A T?F value to control whether list items are indented.} |
Hao Zhu | 62cdde5 | 2017-05-20 22:16:03 -0400 | [diff] [blame] | 99 | } |
| 100 | \description{ |
Hao Zhu | bd95bb2 | 2017-05-22 16:08:49 -0400 | [diff] [blame] | 101 | Group a few rows in a table together under a label. |
Hao Zhu | 62cdde5 | 2017-05-20 22:16:03 -0400 | [diff] [blame] | 102 | } |
Hao Zhu | 78e6122 | 2017-05-24 20:53:35 -0400 | [diff] [blame] | 103 | \examples{ |
| 104 | x <- knitr::kable(head(mtcars), "html") |
| 105 | # 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] | 106 | pack_rows(x, "Group A", 2, 5) |
Hao Zhu | 78e6122 | 2017-05-24 20:53:35 -0400 | [diff] [blame] | 107 | |
| 108 | } |