blob: 698c6882134ae8fb2c3b20c037b5ad795f6bb82e [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,
25 latex_valign = "p"
Hao Zhu9410a272020-08-03 01:11:47 -040026)
Hao Zhubff01912017-05-23 18:05:00 -040027}
28\arguments{
Hao Zhu76281fe2017-07-03 19:33:09 -040029\item{kable_input}{Output of \code{knitr::kable()} with \code{format} specified}
Hao Zhubff01912017-05-23 18:05:00 -040030
Hao Zhu322de082017-09-11 19:25:29 -040031\item{column}{A numeric value or vector indicating which column(s) to be selected.}
Hao Zhubff01912017-05-23 18:05:00 -040032
33\item{width}{A character string telling HTML & LaTeX how wide the column
34needs to be, e.g. "10cm", "3in" or "30em".}
35
36\item{bold}{A T/F value to control whether the text of the selected column
37need to be bolded.}
38
39\item{italic}{A T/F value to control whether the text of the selected column
40need to be emphasized.}
Hao Zhu8f202992017-07-15 02:20:18 -040041
42\item{monospace}{A T/F value to control whether the text of the selected column
43need to be monospaced (verbatim)}
Hao Zhuec7ab922017-08-19 22:56:44 -040044
Hao Zhu53454f02018-01-14 16:29:10 -050045\item{underline}{A T/F value to control whether the text of the selected row
46need to be underlined}
47
48\item{strikeout}{A T/F value to control whether the text of the selected row
49need to be stricked out.}
50
Hao Zhu53e240f2017-09-04 20:04:29 -040051\item{color}{A character string for column text color. Here please pay
52attention to the differences in color codes between HTML and LaTeX.}
Hao Zhuec7ab922017-08-19 22:56:44 -040053
Hao Zhu53e240f2017-09-04 20:04:29 -040054\item{background}{A character string for column background color. Here please
55pay attention to the differences in color codes between HTML and LaTeX.}
56
57\item{border_left}{A logical variable indicating whether there should be a
58border line on the left of the selected column. In HTML, you can also pass
59in a character string for the CSS of the border line}
60
61\item{border_right}{A logical variable indicating whether there should be a
62border line on the right of the selected column. In HTML, you can also pass
63in a character string for the CSS of the border line}
Hao Zhub1de9672018-01-08 16:29:24 -050064
Hao Zhu6107f372018-05-21 00:23:26 -040065\item{width_min}{Only for HTML table. Normal column width will automatically
66collapse when the window cannot hold enough contents. With this \code{width_min},
67you can set up a column with a width that won't collapse even when the
68window is not wide enough.}
69
70\item{width_max}{Only for HTML table. \code{width_max} defines the maximum width
71of table columns.}
72
Hao Zhub1de9672018-01-08 16:29:24 -050073\item{extra_css}{Extra css text to be passed into the cells of the row. Note
74that it's not for the whole column but to each individual cells}
Hao Zhub1caa272018-04-14 14:19:46 -040075
Hao Zhu907ddfe2018-04-23 15:19:09 -040076\item{include_thead}{T/F. A HTML only feature to contoll whether the
77header row will be manipulated. Default is \code{FALSE}.}
Duncan Murdoch8bc96222019-04-29 12:46:39 -040078
79\item{latex_column_spec}{Only for LaTeX tables. Code to replace the column
80specification. If not \code{NULL}, will override all other arguments.}
Hao Zhu2b739ac2020-08-15 01:38:51 -040081
82\item{latex_valign}{vertical alignment. Only works when you specified column
83width. Choose among \code{p}, \code{m}, \code{b}.}
Hao Zhubff01912017-05-23 18:05:00 -040084}
85\description{
86This function allows users to select a column and then specify
Hao Zhue7c8f702017-10-10 13:22:59 -040087its look.
Hao Zhubff01912017-05-23 18:05:00 -040088}
Duncan Murdoch8bc96222019-04-29 12:46:39 -040089\details{
90Use \code{latex_column_spec} in a LaTeX table to change or
91customize the column specification. Because of the way it is handled
92internally, any backslashes must be escaped.
93}
Hao Zhu78e61222017-05-24 20:53:35 -040094\examples{
95x <- knitr::kable(head(mtcars), "html")
Hao Zhu4840bc92017-09-15 15:55:05 -040096column_spec(x, 1:2, width = "20em", bold = TRUE, italic = TRUE)
Duncan Murdoch8bc96222019-04-29 12:46:39 -040097x <- knitr::kable(head(mtcars), "latex", booktabs = TRUE)
98column_spec(x, 1, latex_column_spec = ">{\\\\\\\\color{red}}c")
Hao Zhu78e61222017-05-24 20:53:35 -040099}