Hao Zhu | 2a87e8e | 2017-06-14 15:49:33 -0400 | [diff] [blame] | 1 | % Generated by roxygen2: do not edit by hand |
| 2 | % Please edit documentation in R/collapse_rows.R |
| 3 | \name{collapse_rows} |
| 4 | \alias{collapse_rows} |
Hao Zhu | 8a160b1 | 2017-06-26 13:41:35 -1000 | [diff] [blame] | 5 | \title{Collapse repeated rows to multirow cell} |
Hao Zhu | 2a87e8e | 2017-06-14 15:49:33 -0400 | [diff] [blame] | 6 | \usage{ |
Hao Zhu | 8a160b1 | 2017-06-26 13:41:35 -1000 | [diff] [blame] | 7 | collapse_rows(kable_input, columns = NULL) |
| 8 | } |
| 9 | \arguments{ |
| 10 | \item{kable_input}{Output of `knitr::kable()` with `format` specified} |
| 11 | |
| 12 | \item{columns}{Numeric column positions where rows need to be collapsed.} |
Hao Zhu | 2a87e8e | 2017-06-14 15:49:33 -0400 | [diff] [blame] | 13 | } |
| 14 | \description{ |
Hao Zhu | 8a160b1 | 2017-06-26 13:41:35 -1000 | [diff] [blame] | 15 | Collapse same values in columns into multirow cells. This |
| 16 | feature does similar things with `group_rows`. However, unlike `group_rows`, |
| 17 | it analyzes existing columns, finds out rows that can be grouped together, |
| 18 | and make them multirow cells. Note that if you want to use `column_spec` to |
| 19 | specify column styles, you should use `column_spec` before `collapse_rows`. |
Hao Zhu | 2a87e8e | 2017-06-14 15:49:33 -0400 | [diff] [blame] | 20 | } |
Hao Zhu | 5a7689e | 2017-06-26 15:37:24 -1000 | [diff] [blame^] | 21 | \examples{ |
| 22 | dt <- data.frame(a = c(1, 1, 2, 2), b = c("a", "a", "a", "b")) |
| 23 | x <- knitr::kable(dt, "html") |
| 24 | collapse_rows(x) |
| 25 | |
| 26 | } |