cbind.huxtable: Combine rows or columns

Description Usage Arguments Details Value Examples

Description

These methods are called when one argument to cbind/rbind is a huxtable. As well as combining cell contents, they copy table, row, column and/or cell properties into the returned result.

Usage

1
2
3
4
5
## S3 method for class 'huxtable'
cbind(..., deparse.level = 1, copy_cell_props = TRUE)

## S3 method for class 'huxtable'
rbind(..., deparse.level = 1, copy_cell_props = TRUE)

Arguments

...

Vectors, matrices, or huxtables.

deparse.level

Unused.

copy_cell_props

Cell properties to copy from neighbours (see below).

Details

Table properties will be taken from the first argument which is a huxtable. So will row properties (for cbind) and column properties (for rbind).

If some of the inputs are not huxtables, and copy_cell_props isTRUE, then cell properties will be copied to non-huxtables. Objects on the left or above get priority over those on the right or below.

If copy_cell_props is FALSE, cells from non-huxtable objects will get the default properties.

You cannot bind huxtables with data frames, since the R method dispatch will always call the data frame method instead of the huxtable-specific code. For a solution, see add_columns().

Value

A huxtable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sugar <- c("Sugar", "40%", "35%", "50%")
jams <- set_bold(jams, 1, everywhere)
cbind(jams, sugar)
cbind(jams, sugar,
     copy_cell_props = FALSE)

jams <- set_text_color(jams,
     everywhere, 1, "red")
rbind(jams, c("Damson", 2.30))
rbind(jams, c("Damson", 2.30),
     copy_cell_props = FALSE)

huxtable documentation built on May 15, 2021, 1:09 a.m.