R: Combine rows or columns

cbind.huxtable {huxtable} | R Documentation

## Combine rows or columns

### Description

Combine rows or columns

### Usage

    ## 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` is a character vector of cell properties, then the named cell properties will be copied to non-huxtables. Objects on the left or above get priority over those on the right or below. These properties may also include `"row_height"` (for rbind) or `"col_width"` (for cbind). Numeric row heights and column widths will be rescaled to 1.

If `copy_cell_props` is `TRUE`, the default set of cell properties (everything but `colspan` and `rowspan`, including row heights/column widths) will be copied.

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

NB: 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

    ht1 <- hux(a = 1:3, b = 4:6)
    ht2 <- hux(d = letters[1:3], e = letters[4:6])
    bold(ht1)[1,] <- TRUE
    bold(ht2) <- TRUE
    vec <- LETTERS[1:3]

    ht_out <- cbind(ht1, vec, ht2)
    ht_out
    bold(ht_out)
    bold(cbind(ht1, vec, ht2, copy_cell_props = FALSE))

[Package huxtable version 4.2.0 Index]