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