blob: b611fad573e96f9775c937495b57bc7cecac8228 [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 Zhu78e61222017-05-24 20:53:35 -04007column_spec(kable_input, column, width = NULL, bold = FALSE,
Hao Zhu53454f02018-01-14 16:29:10 -05008 italic = FALSE, monospace = FALSE, underline = FALSE,
9 strikeout = FALSE, color = NULL, background = NULL,
Hao Zhub1caa272018-04-14 14:19:46 -040010 border_left = FALSE, border_right = FALSE, width_min = NULL,
Duncan Murdoch8bc96222019-04-29 12:46:39 -040011 width_max = NULL, extra_css = NULL, include_thead = FALSE,
12 latex_column_spec = NULL)
Hao Zhubff01912017-05-23 18:05:00 -040013}
14\arguments{
Hao Zhu76281fe2017-07-03 19:33:09 -040015\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
Hao Zhubff01912017-05-23 18:05:00 -040016
Hao Zhu322de082017-09-11 19:25:29 -040017\item{column}{A numeric value or vector indicating which column(s) to be selected.}
Hao Zhubff01912017-05-23 18:05:00 -040018
19\item{width}{A character string telling HTML & LaTeX how wide the column
20needs to be, e.g. "10cm", "3in" or "30em".}
21
22\item{bold}{A T/F value to control whether the text of the selected column
23need to be bolded.}
24
25\item{italic}{A T/F value to control whether the text of the selected column
26need to be emphasized.}
Hao Zhu8f202992017-07-15 02:20:18 -040027
28\item{monospace}{A T/F value to control whether the text of the selected column
29need to be monospaced (verbatim)}
Hao Zhuec7ab922017-08-19 22:56:44 -040030
Hao Zhu53454f02018-01-14 16:29:10 -050031\item{underline}{A T/F value to control whether the text of the selected row
32need to be underlined}
33
34\item{strikeout}{A T/F value to control whether the text of the selected row
35need to be stricked out.}
36
Hao Zhu53e240f2017-09-04 20:04:29 -040037\item{color}{A character string for column text color. Here please pay
38attention to the differences in color codes between HTML and LaTeX.}
Hao Zhuec7ab922017-08-19 22:56:44 -040039
Hao Zhu53e240f2017-09-04 20:04:29 -040040\item{background}{A character string for column background color. Here please
41pay attention to the differences in color codes between HTML and LaTeX.}
42
43\item{border_left}{A logical variable indicating whether there should be a
44border line on the left of the selected column. In HTML, you can also pass
45in a character string for the CSS of the border line}
46
47\item{border_right}{A logical variable indicating whether there should be a
48border line on the right of the selected column. In HTML, you can also pass
49in a character string for the CSS of the border line}
Hao Zhub1de9672018-01-08 16:29:24 -050050
Hao Zhu6107f372018-05-21 00:23:26 -040051\item{width_min}{Only for HTML table. Normal column width will automatically
52collapse when the window cannot hold enough contents. With this \code{width_min},
53you can set up a column with a width that won't collapse even when the
54window is not wide enough.}
55
56\item{width_max}{Only for HTML table. \code{width_max} defines the maximum width
57of table columns.}
58
Hao Zhub1de9672018-01-08 16:29:24 -050059\item{extra_css}{Extra css text to be passed into the cells of the row. Note
60that it's not for the whole column but to each individual cells}
Hao Zhub1caa272018-04-14 14:19:46 -040061
Hao Zhu907ddfe2018-04-23 15:19:09 -040062\item{include_thead}{T/F. A HTML only feature to contoll whether the
63header row will be manipulated. Default is \code{FALSE}.}
Duncan Murdoch8bc96222019-04-29 12:46:39 -040064
65\item{latex_column_spec}{Only for LaTeX tables. Code to replace the column
66specification. If not \code{NULL}, will override all other arguments.}
Hao Zhubff01912017-05-23 18:05:00 -040067}
68\description{
69This function allows users to select a column and then specify
Hao Zhue7c8f702017-10-10 13:22:59 -040070its look.
Hao Zhubff01912017-05-23 18:05:00 -040071}
Duncan Murdoch8bc96222019-04-29 12:46:39 -040072\details{
73Use \code{latex_column_spec} in a LaTeX table to change or
74customize the column specification. Because of the way it is handled
75internally, any backslashes must be escaped.
76}
Hao Zhu78e61222017-05-24 20:53:35 -040077\examples{
78x <- knitr::kable(head(mtcars), "html")
Hao Zhu4840bc92017-09-15 15:55:05 -040079column_spec(x, 1:2, width = "20em", bold = TRUE, italic = TRUE)
Duncan Murdoch8bc96222019-04-29 12:46:39 -040080x <- knitr::kable(head(mtcars), "latex", booktabs = TRUE)
81column_spec(x, 1, latex_column_spec = ">{\\\\\\\\color{red}}c")
Hao Zhu78e61222017-05-24 20:53:35 -040082}