kableExtra (version 1.4.0)

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 struck 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 adds a hline after the row

extra_latex_after

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

Examples

Run this code
if (FALSE) {
x <- knitr::kable(head(mtcars), "html")
row_spec(x, 1:2, bold = TRUE, italic = TRUE)
}

Run the code above in your browser using DataLab