rowspecs {huxtable}R Documentation

Different ways to select rows and columns

Description

This help page describes how to use the row and col arguments in ⁠set_*⁠ functions.

The basics

The ⁠set_*⁠ functions for cell properties all have arguments like this: set_property(ht, row, col, value).

You can treat row and col arguments like arguments for data frame subsetting. For example, you can use row = 1:3 to get the first three rows, col = "salary" to specify the column named "salary", or row = ht$salary >= 50000 to specify rows where a condition is true.

There are also a few extra tricks you can use:

The gory details

How the row and col arguments are parsed depends on the number of arguments passed to the ⁠set_*⁠ function.

Examples

set_bold(jams, 2:4, 1:2, TRUE)
set_background_color(jams, evens, everywhere,
      "grey95")
set_bold(jams, everywhere,
      tidyselect::matches("yp"), TRUE)

set_text_color(jams, 2:4, 1:2,
      c("red", "violetred", "purple"))

[Package huxtable version 5.5.6 Index]