blob: 8d19fc794c1f4a2328842b56565c339f763d11b7 [file] [log] [blame]
Hao Zhubff01912017-05-23 18:05:00 -04001% 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 Zhu9410a272020-08-03 01:11:47 -04007column_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 Zhu2b739ac2020-08-15 01:38:51 -040024 latex_column_spec = NULL,
Hao Zhu33b865f2020-08-18 02:10:43 -040025 latex_valign = "p",
26 link = NULL,
27 new_tab = TRUE,
28 tooltip = NULL,
Hao Zhu5fe235c2020-08-26 00:26:49 -040029 popover = NULL,
30 image = NULL
Hao Zhu9410a272020-08-03 01:11:47 -040031)
Hao Zhubff01912017-05-23 18:05:00 -040032}
33\arguments{
Hao Zhu76281fe2017-07-03 19:33:09 -040034\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
Hao Zhubff01912017-05-23 18:05:00 -040035
Hao Zhu322de082017-09-11 19:25:29 -040036\item{column}{A numeric value or vector indicating which column(s) to be selected.}
Hao Zhubff01912017-05-23 18:05:00 -040037
38\item{width}{A character string telling HTML & LaTeX how wide the column
39needs to be, e.g. "10cm", "3in" or "30em".}
40
Hao Zhu33b865f2020-08-18 02:10:43 -040041\item{bold}{T/F value or vector to control whether the text of the selected
42column need to be bolded.}
Hao Zhubff01912017-05-23 18:05:00 -040043
Hao Zhu33b865f2020-08-18 02:10:43 -040044\item{italic}{T/F value or vector to control whether the text of the
45selected column need to be emphasized.}
Hao Zhu8f202992017-07-15 02:20:18 -040046
Hao Zhu33b865f2020-08-18 02:10:43 -040047\item{monospace}{T/F value or vector to control whether the text of the
48selected column need to be monospaced (verbatim)}
Hao Zhuec7ab922017-08-19 22:56:44 -040049
Hao Zhu33b865f2020-08-18 02:10:43 -040050\item{underline}{T/F value or vector to control whether the text of the
51selected row need to be underlined}
Hao Zhu53454f02018-01-14 16:29:10 -050052
Hao Zhu33b865f2020-08-18 02:10:43 -040053\item{strikeout}{T/F value or vector to control whether the text of the
54selected row need to be striked out.}
Hao Zhu53454f02018-01-14 16:29:10 -050055
Hao Zhu33b865f2020-08-18 02:10:43 -040056\item{color}{A character string or vector for column text color. Here please
57pay attention to the differences in color codes between HTML and LaTeX.}
Hao Zhuec7ab922017-08-19 22:56:44 -040058
Hao Zhu33b865f2020-08-18 02:10:43 -040059\item{background}{A character string or vector for column background color. Here please
Hao Zhu53e240f2017-09-04 20:04:29 -040060pay 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
63border line on the left of the selected column. In HTML, you can also pass
64in a character string for the CSS of the border line}
65
66\item{border_right}{A logical variable indicating whether there should be a
67border line on the right of the selected column. In HTML, you can also pass
68in a character string for the CSS of the border line}
Hao Zhub1de9672018-01-08 16:29:24 -050069
Hao Zhu6107f372018-05-21 00:23:26 -040070\item{width_min}{Only for HTML table. Normal column width will automatically
71collapse when the window cannot hold enough contents. With this \code{width_min},
72you can set up a column with a width that won't collapse even when the
73window is not wide enough.}
74
75\item{width_max}{Only for HTML table. \code{width_max} defines the maximum width
76of table columns.}
77
Hao Zhu33b865f2020-08-18 02:10:43 -040078\item{extra_css}{A vector of extra css text to be passed into the cells of
79the column.}
Hao Zhub1caa272018-04-14 14:19:46 -040080
Hao Zhu907ddfe2018-04-23 15:19:09 -040081\item{include_thead}{T/F. A HTML only feature to contoll whether the
82header row will be manipulated. Default is \code{FALSE}.}
Duncan Murdoch8bc96222019-04-29 12:46:39 -040083
84\item{latex_column_spec}{Only for LaTeX tables. Code to replace the column
85specification. If not \code{NULL}, will override all other arguments.}
Hao Zhu2b739ac2020-08-15 01:38:51 -040086
87\item{latex_valign}{vertical alignment. Only works when you specified column
88width. Choose among \code{p}, \code{m}, \code{b}.}
Hao Zhu33b865f2020-08-18 02:10:43 -040089
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.
95Obviously, this feature is only available in HTML. Read the package
96vignette to see how to use bootstrap tooltip css to improve the loading
97speed and look.}
98
99\item{popover}{Similar with tooltip but can hold more contents. The best way
100to build a popover is through \code{spec_popover()}. If you only provide a text
101string, it will be used as content. Note that You have to enable this
102bootstrap module manually. Read the package vignette to see how.}
Hao Zhu5fe235c2020-08-26 00:26:49 -0400103
104\item{image}{Vector of image paths.}
Hao Zhubff01912017-05-23 18:05:00 -0400105}
106\description{
107This function allows users to select a column and then specify
Hao Zhue7c8f702017-10-10 13:22:59 -0400108its look.
Hao Zhubff01912017-05-23 18:05:00 -0400109}
Duncan Murdoch8bc96222019-04-29 12:46:39 -0400110\details{
111Use \code{latex_column_spec} in a LaTeX table to change or
112customize the column specification. Because of the way it is handled
113internally, any backslashes must be escaped.
114}
Hao Zhu78e61222017-05-24 20:53:35 -0400115\examples{
116x <- knitr::kable(head(mtcars), "html")
Hao Zhu4840bc92017-09-15 15:55:05 -0400117column_spec(x, 1:2, width = "20em", bold = TRUE, italic = TRUE)
Duncan Murdoch8bc96222019-04-29 12:46:39 -0400118x <- knitr::kable(head(mtcars), "latex", booktabs = TRUE)
119column_spec(x, 1, latex_column_spec = ">{\\\\\\\\color{red}}c")
Hao Zhu78e61222017-05-24 20:53:35 -0400120}