blob: aeff8ec074ab8826222c3ddd13bbd28a5a0e1876 [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,
29 popover = NULL
Hao Zhu9410a272020-08-03 01:11:47 -040030)
Hao Zhubff01912017-05-23 18:05:00 -040031}
32\arguments{
Hao Zhu76281fe2017-07-03 19:33:09 -040033\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
Hao Zhubff01912017-05-23 18:05:00 -040034
Hao Zhu322de082017-09-11 19:25:29 -040035\item{column}{A numeric value or vector indicating which column(s) to be selected.}
Hao Zhubff01912017-05-23 18:05:00 -040036
37\item{width}{A character string telling HTML & LaTeX how wide the column
38needs to be, e.g. "10cm", "3in" or "30em".}
39
Hao Zhu33b865f2020-08-18 02:10:43 -040040\item{bold}{T/F value or vector to control whether the text of the selected
41column need to be bolded.}
Hao Zhubff01912017-05-23 18:05:00 -040042
Hao Zhu33b865f2020-08-18 02:10:43 -040043\item{italic}{T/F value or vector to control whether the text of the
44selected column need to be emphasized.}
Hao Zhu8f202992017-07-15 02:20:18 -040045
Hao Zhu33b865f2020-08-18 02:10:43 -040046\item{monospace}{T/F value or vector to control whether the text of the
47selected column need to be monospaced (verbatim)}
Hao Zhuec7ab922017-08-19 22:56:44 -040048
Hao Zhu33b865f2020-08-18 02:10:43 -040049\item{underline}{T/F value or vector to control whether the text of the
50selected row need to be underlined}
Hao Zhu53454f02018-01-14 16:29:10 -050051
Hao Zhu33b865f2020-08-18 02:10:43 -040052\item{strikeout}{T/F value or vector to control whether the text of the
53selected row need to be striked out.}
Hao Zhu53454f02018-01-14 16:29:10 -050054
Hao Zhu33b865f2020-08-18 02:10:43 -040055\item{color}{A character string or vector for column text color. Here please
56pay attention to the differences in color codes between HTML and LaTeX.}
Hao Zhuec7ab922017-08-19 22:56:44 -040057
Hao Zhu33b865f2020-08-18 02:10:43 -040058\item{background}{A character string or vector for column background color. Here please
Hao Zhu53e240f2017-09-04 20:04:29 -040059pay attention to the differences in color codes between HTML and LaTeX.}
60
61\item{border_left}{A logical variable indicating whether there should be a
62border line on the left of the selected column. In HTML, you can also pass
63in a character string for the CSS of the border line}
64
65\item{border_right}{A logical variable indicating whether there should be a
66border line on the right of the selected column. In HTML, you can also pass
67in a character string for the CSS of the border line}
Hao Zhub1de9672018-01-08 16:29:24 -050068
Hao Zhu6107f372018-05-21 00:23:26 -040069\item{width_min}{Only for HTML table. Normal column width will automatically
70collapse when the window cannot hold enough contents. With this \code{width_min},
71you can set up a column with a width that won't collapse even when the
72window is not wide enough.}
73
74\item{width_max}{Only for HTML table. \code{width_max} defines the maximum width
75of table columns.}
76
Hao Zhu33b865f2020-08-18 02:10:43 -040077\item{extra_css}{A vector of extra css text to be passed into the cells of
78the column.}
Hao Zhub1caa272018-04-14 14:19:46 -040079
Hao Zhu907ddfe2018-04-23 15:19:09 -040080\item{include_thead}{T/F. A HTML only feature to contoll whether the
81header row will be manipulated. Default is \code{FALSE}.}
Duncan Murdoch8bc96222019-04-29 12:46:39 -040082
83\item{latex_column_spec}{Only for LaTeX tables. Code to replace the column
84specification. If not \code{NULL}, will override all other arguments.}
Hao Zhu2b739ac2020-08-15 01:38:51 -040085
86\item{latex_valign}{vertical alignment. Only works when you specified column
87width. Choose among \code{p}, \code{m}, \code{b}.}
Hao Zhu33b865f2020-08-18 02:10:43 -040088
89\item{link}{A vector of strings for url links.}
90
91\item{new_tab}{T/F for whether to open up the new link in new tab}
92
93\item{tooltip}{A vector of strings to be displayed as tooltip.
94Obviously, this feature is only available in HTML. Read the package
95vignette to see how to use bootstrap tooltip css to improve the loading
96speed and look.}
97
98\item{popover}{Similar with tooltip but can hold more contents. The best way
99to build a popover is through \code{spec_popover()}. If you only provide a text
100string, it will be used as content. Note that You have to enable this
101bootstrap module manually. Read the package vignette to see how.}
Hao Zhubff01912017-05-23 18:05:00 -0400102}
103\description{
104This function allows users to select a column and then specify
Hao Zhue7c8f702017-10-10 13:22:59 -0400105its look.
Hao Zhubff01912017-05-23 18:05:00 -0400106}
Duncan Murdoch8bc96222019-04-29 12:46:39 -0400107\details{
108Use \code{latex_column_spec} in a LaTeX table to change or
109customize the column specification. Because of the way it is handled
110internally, any backslashes must be escaped.
111}
Hao Zhu78e61222017-05-24 20:53:35 -0400112\examples{
113x <- knitr::kable(head(mtcars), "html")
Hao Zhu4840bc92017-09-15 15:55:05 -0400114column_spec(x, 1:2, width = "20em", bold = TRUE, italic = TRUE)
Duncan Murdoch8bc96222019-04-29 12:46:39 -0400115x <- knitr::kable(head(mtcars), "latex", booktabs = TRUE)
116column_spec(x, 1, latex_column_spec = ">{\\\\\\\\color{red}}c")
Hao Zhu78e61222017-05-24 20:53:35 -0400117}