Hao Zhu | bff0191 | 2017-05-23 18:05:00 -0400 | [diff] [blame] | 1 | % Generated by roxygen2: do not edit by hand |
| 2 | % Please edit documentation in R/column_spec.R |
| 3 | \name{column_spec} |
| 4 | \alias{column_spec} |
| 5 | \title{Specify the look of the selected column} |
| 6 | \usage{ |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 7 | column_spec( |
| 8 | kable_input, |
| 9 | column, |
| 10 | width = NULL, |
| 11 | bold = FALSE, |
| 12 | italic = FALSE, |
| 13 | monospace = FALSE, |
| 14 | underline = FALSE, |
| 15 | strikeout = FALSE, |
| 16 | color = NULL, |
| 17 | background = NULL, |
| 18 | border_left = FALSE, |
| 19 | border_right = FALSE, |
| 20 | width_min = NULL, |
| 21 | width_max = NULL, |
| 22 | extra_css = NULL, |
| 23 | include_thead = FALSE, |
Hao Zhu | 2b739ac | 2020-08-15 01:38:51 -0400 | [diff] [blame] | 24 | latex_column_spec = NULL, |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 25 | latex_valign = "p", |
| 26 | link = NULL, |
| 27 | new_tab = TRUE, |
| 28 | tooltip = NULL, |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 29 | popover = NULL, |
| 30 | image = NULL |
Hao Zhu | 9410a27 | 2020-08-03 01:11:47 -0400 | [diff] [blame] | 31 | ) |
Hao Zhu | bff0191 | 2017-05-23 18:05:00 -0400 | [diff] [blame] | 32 | } |
| 33 | \arguments{ |
Hao Zhu | 76281fe | 2017-07-03 19:33:09 -0400 | [diff] [blame] | 34 | \item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified} |
Hao Zhu | bff0191 | 2017-05-23 18:05:00 -0400 | [diff] [blame] | 35 | |
Hao Zhu | 322de08 | 2017-09-11 19:25:29 -0400 | [diff] [blame] | 36 | \item{column}{A numeric value or vector indicating which column(s) to be selected.} |
Hao Zhu | bff0191 | 2017-05-23 18:05:00 -0400 | [diff] [blame] | 37 | |
| 38 | \item{width}{A character string telling HTML & LaTeX how wide the column |
| 39 | needs to be, e.g. "10cm", "3in" or "30em".} |
| 40 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 41 | \item{bold}{T/F value or vector to control whether the text of the selected |
| 42 | column need to be bolded.} |
Hao Zhu | bff0191 | 2017-05-23 18:05:00 -0400 | [diff] [blame] | 43 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 44 | \item{italic}{T/F value or vector to control whether the text of the |
| 45 | selected column need to be emphasized.} |
Hao Zhu | 8f20299 | 2017-07-15 02:20:18 -0400 | [diff] [blame] | 46 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 47 | \item{monospace}{T/F value or vector to control whether the text of the |
| 48 | selected column need to be monospaced (verbatim)} |
Hao Zhu | ec7ab92 | 2017-08-19 22:56:44 -0400 | [diff] [blame] | 49 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 50 | \item{underline}{T/F value or vector to control whether the text of the |
| 51 | selected row need to be underlined} |
Hao Zhu | 53454f0 | 2018-01-14 16:29:10 -0500 | [diff] [blame] | 52 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 53 | \item{strikeout}{T/F value or vector to control whether the text of the |
| 54 | selected row need to be striked out.} |
Hao Zhu | 53454f0 | 2018-01-14 16:29:10 -0500 | [diff] [blame] | 55 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 56 | \item{color}{A character string or vector for column text color. Here please |
| 57 | pay attention to the differences in color codes between HTML and LaTeX.} |
Hao Zhu | ec7ab92 | 2017-08-19 22:56:44 -0400 | [diff] [blame] | 58 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 59 | \item{background}{A character string or vector for column background color. Here please |
Hao Zhu | 53e240f | 2017-09-04 20:04:29 -0400 | [diff] [blame] | 60 | pay attention to the differences in color codes between HTML and LaTeX.} |
| 61 | |
| 62 | \item{border_left}{A logical variable indicating whether there should be a |
| 63 | border line on the left of the selected column. In HTML, you can also pass |
| 64 | in a character string for the CSS of the border line} |
| 65 | |
| 66 | \item{border_right}{A logical variable indicating whether there should be a |
| 67 | border line on the right of the selected column. In HTML, you can also pass |
| 68 | in a character string for the CSS of the border line} |
Hao Zhu | b1de967 | 2018-01-08 16:29:24 -0500 | [diff] [blame] | 69 | |
Hao Zhu | 6107f37 | 2018-05-21 00:23:26 -0400 | [diff] [blame] | 70 | \item{width_min}{Only for HTML table. Normal column width will automatically |
| 71 | collapse when the window cannot hold enough contents. With this \code{width_min}, |
| 72 | you can set up a column with a width that won't collapse even when the |
| 73 | window is not wide enough.} |
| 74 | |
| 75 | \item{width_max}{Only for HTML table. \code{width_max} defines the maximum width |
| 76 | of table columns.} |
| 77 | |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 78 | \item{extra_css}{A vector of extra css text to be passed into the cells of |
| 79 | the column.} |
Hao Zhu | b1caa27 | 2018-04-14 14:19:46 -0400 | [diff] [blame] | 80 | |
Hao Zhu | 907ddfe | 2018-04-23 15:19:09 -0400 | [diff] [blame] | 81 | \item{include_thead}{T/F. A HTML only feature to contoll whether the |
| 82 | header row will be manipulated. Default is \code{FALSE}.} |
Duncan Murdoch | 8bc9622 | 2019-04-29 12:46:39 -0400 | [diff] [blame] | 83 | |
| 84 | \item{latex_column_spec}{Only for LaTeX tables. Code to replace the column |
| 85 | specification. If not \code{NULL}, will override all other arguments.} |
Hao Zhu | 2b739ac | 2020-08-15 01:38:51 -0400 | [diff] [blame] | 86 | |
| 87 | \item{latex_valign}{vertical alignment. Only works when you specified column |
| 88 | width. Choose among \code{p}, \code{m}, \code{b}.} |
Hao Zhu | 33b865f | 2020-08-18 02:10:43 -0400 | [diff] [blame] | 89 | |
| 90 | \item{link}{A vector of strings for url links.} |
| 91 | |
| 92 | \item{new_tab}{T/F for whether to open up the new link in new tab} |
| 93 | |
| 94 | \item{tooltip}{A vector of strings to be displayed as tooltip. |
| 95 | Obviously, this feature is only available in HTML. Read the package |
| 96 | vignette to see how to use bootstrap tooltip css to improve the loading |
| 97 | speed and look.} |
| 98 | |
| 99 | \item{popover}{Similar with tooltip but can hold more contents. The best way |
| 100 | to build a popover is through \code{spec_popover()}. If you only provide a text |
| 101 | string, it will be used as content. Note that You have to enable this |
| 102 | bootstrap module manually. Read the package vignette to see how.} |
Hao Zhu | 5fe235c | 2020-08-26 00:26:49 -0400 | [diff] [blame] | 103 | |
| 104 | \item{image}{Vector of image paths.} |
Hao Zhu | bff0191 | 2017-05-23 18:05:00 -0400 | [diff] [blame] | 105 | } |
| 106 | \description{ |
| 107 | This function allows users to select a column and then specify |
Hao Zhu | e7c8f70 | 2017-10-10 13:22:59 -0400 | [diff] [blame] | 108 | its look. |
Hao Zhu | bff0191 | 2017-05-23 18:05:00 -0400 | [diff] [blame] | 109 | } |
Duncan Murdoch | 8bc9622 | 2019-04-29 12:46:39 -0400 | [diff] [blame] | 110 | \details{ |
| 111 | Use \code{latex_column_spec} in a LaTeX table to change or |
| 112 | customize the column specification. Because of the way it is handled |
| 113 | internally, any backslashes must be escaped. |
| 114 | } |
Hao Zhu | 78e6122 | 2017-05-24 20:53:35 -0400 | [diff] [blame] | 115 | \examples{ |
Hao Zhu | 9399dcc | 2020-08-26 17:27:38 -0400 | [diff] [blame^] | 116 | \dontrun{ |
Hao Zhu | 78e6122 | 2017-05-24 20:53:35 -0400 | [diff] [blame] | 117 | x <- knitr::kable(head(mtcars), "html") |
Hao Zhu | 4840bc9 | 2017-09-15 15:55:05 -0400 | [diff] [blame] | 118 | column_spec(x, 1:2, width = "20em", bold = TRUE, italic = TRUE) |
Duncan Murdoch | 8bc9622 | 2019-04-29 12:46:39 -0400 | [diff] [blame] | 119 | x <- knitr::kable(head(mtcars), "latex", booktabs = TRUE) |
| 120 | column_spec(x, 1, latex_column_spec = ">{\\\\\\\\color{red}}c") |
Hao Zhu | 78e6122 | 2017-05-24 20:53:35 -0400 | [diff] [blame] | 121 | } |
Hao Zhu | 9399dcc | 2020-08-26 17:27:38 -0400 | [diff] [blame^] | 122 | } |