Skip to contents

rbind TableTree and related objects

Usage

rbindl_rtables(x, gap = 0, check_headers = TRUE)

# S4 method for VTableNodeInfo
rbind(..., deparse.level = 1)

# S4 method for VTableNodeInfo,ANY
rbind2(x, y)

Arguments

x

VTableNodeInfo. TableTree, ElementaryTable or TableRow object.

gap

deprecated. Ignored.

check_headers

deprecated. Ignored.

...

ANY. Elements to be stacked.

deparse.level

numeric(1). Currently Ignored.

y

VTableNodeInfo. TableTree, ElementaryTable or TableRow object.

Value

A formal table object.

Note

When objects are rbinded, titles and footer information is retained from the first object (if any exists) if all other objects have no titles/footers or have identical titles/footers. Otherwise, all titles/footers are removed and must be set for the bound table via the main_title(), subtitles(), main_footer(), and prov_footer() functions.

Examples

mtbl <- rtable(
  header = rheader(
    rrow(row.name = NULL, rcell("Sepal.Length", colspan = 2), rcell("Petal.Length", colspan = 2)),
    rrow(NULL, "mean", "median", "mean", "median")
  ),
  rrow(
    row.name = "All Species",
    mean(iris$Sepal.Length), median(iris$Sepal.Length),
    mean(iris$Petal.Length), median(iris$Petal.Length),
    format = "xx.xx"
  )
)

mtbl2 <- with(subset(iris, Species == "setosa"), rtable(
  header = rheader(
    rrow(row.name = NULL, rcell("Sepal.Length", colspan = 2), rcell("Petal.Length", colspan = 2)),
    rrow(NULL, "mean", "median", "mean", "median")
  ),
  rrow(
    row.name = "Setosa",
    mean(Sepal.Length), median(Sepal.Length),
    mean(Petal.Length), median(Petal.Length),
    format = "xx.xx"
  )
))

rbind(mtbl, mtbl2)
#>                Sepal.Length      Petal.Length  
#>               mean    median    mean    median 
#> ———————————————————————————————————————————————
#> All Species   5.84     5.80     3.76     4.35  
#> Setosa        5.01     5.00     1.46     1.50  
rbind(mtbl, rrow(), mtbl2)
#>                Sepal.Length      Petal.Length  
#>               mean    median    mean    median 
#> ———————————————————————————————————————————————
#> All Species   5.84     5.80     3.76     4.35  
#>                                                
#> Setosa        5.01     5.00     1.46     1.50  
rbind(mtbl, rrow("aaa"), indent(mtbl2))
#>                Sepal.Length      Petal.Length  
#>               mean    median    mean    median 
#> ———————————————————————————————————————————————
#> All Species   5.84     5.80     3.76     4.35  
#> aaa                                            
#>   Setosa      5.01     5.00     1.46     1.50