Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

row_spec

Specify the look of the selected row


Description

This function allows users to select a row and then specify its look. It can also specify the format of the header row when row = 0.

Usage

row_spec(
  kable_input,
  row,
  bold = FALSE,
  italic = FALSE,
  monospace = FALSE,
  underline = FALSE,
  strikeout = FALSE,
  color = NULL,
  background = NULL,
  align = NULL,
  font_size = NULL,
  angle = NULL,
  extra_css = NULL,
  hline_after = FALSE,
  extra_latex_after = NULL
)

Arguments

kable_input

Output of knitr::kable() with format specified

row

A numeric value or vector indicating which row(s) to be selected. You don't need to count in header rows or group labeling rows.

bold

A T/F value to control whether the text of the selected row need to be bolded.

italic

A T/F value to control whether the text of the selected row need to be emphasized.

monospace

A T/F value to control whether the text of the selected row need to be monospaced (verbatim)

underline

A T/F value to control whether the text of the selected row need to be underlined

strikeout

A T/F value to control whether the text of the selected row need to be stricked out.

color

A character string for row text color. For example, "red" or "#BBBBBB".

background

A character string for row background color. Here please pay attention to the differences in color codes between HTML and LaTeX.

align

A character string for cell alignment. For HTML, possible values could be l, c, r plus left, center, right, justify, initial and inherit while for LaTeX, you can only choose from l, c & r.

font_size

A numeric input for font size. For HTML, you can also use options including xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger, initial and inherit.

angle

0-360, degree that the text will rotate.

extra_css

Extra css text to be passed into the cells of the row. Note that it's not for the whole row.

hline_after

T/F. A replicate of hline.after in xtable. It addes a hline after ther row

extra_latex_after

Extra LaTeX text to be added after the row. Similar with add.to.row in xtable

Examples

## Not run: 
x <- knitr::kable(head(mtcars), "html")
row_spec(x, 1:2, bold = TRUE, italic = TRUE)

## End(Not run)

kableExtra

Construct Complex Table with 'kable' and Pipe Syntax

v1.3.4
MIT + file LICENSE
Authors
Hao Zhu [aut, cre] (<https://orcid.org/0000-0002-3386-6076>), Thomas Travison [ctb], Timothy Tsai [ctb], Will Beasley [ctb], Yihui Xie [ctb], GuangChuang Yu [ctb], Stéphane Laurent [ctb], Rob Shepherd [ctb], Yoni Sidi [ctb], Brian Salzer [ctb], George Gui [ctb], Yeliang Fan [ctb], Duncan Murdoch [ctb], Bill Evans [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.