rowspecs {huxtable}R Documentation

Row and column specifications

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, byrow = FALSE).

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:

[=[.data.frame]: R:=[.data.frame

The gory details

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

Examples

ht <- huxtable(a = 1:5, b = 5:1)

set_bold(ht, 2:4, 1:2, TRUE)
set_bold(ht, odds, evens, TRUE)
set_bold(ht, everywhere, tidyselect::matches('[aeiou]'), TRUE)

set_bold(ht, where(ht == 1), TRUE)

set_text_color(ht, 2:3, 1:2, c('red', 'blue'))
set_text_color(ht, 2:3, 1:2, c('red', 'blue'), byrow = TRUE)

[Package huxtable version 4.0.1 Index]