Composite_table: Compose Tables

Description Usage Arguments Value See Also Examples

View source: R/Composite_table.R

Description

comp_table() is a drop in replacement for base::cbind() that supports multi-column headings.#'

Usage

1
2
3
comp_table(..., id_vars = NULL, meta = NULL)

comp_table_list(tables, id_vars = NULL, meta = NULL)

Arguments

...

comp_table() only: individual data.frames. A name can be provided for each data.frame that will be used by print() and as_workbook() to create multi-table headings.

id_vars

If id_vars is specified, the tables will be combined using merge() on the columns specified in id_vars, otherwise the tables will be combined with cbind().

meta

a TT_meta object. If specified, the resulting Composite_table will be wrapped in a Tagged_table.

tables

comp_table_list only: A named list of data.frames with the same number of rows

Value

A Composite_table.

See Also

Attribute setter: multinames<-

Other Tatoo tables: mash_table, stack_table, tag_table, tatoo_table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
df_mean <- data.frame(
  Species = c("setosa", "versicolor", "virginica"),
  length = c(5.01, 5.94, 6.59),
  width = c(3.43, 2.77, 2.97)
)

df_sd <- data.frame(
  Species = c("setosa", "versicolor", "virginica"),
  length = c(0.35, 0.52, 0.64),
  width = c(0.38, 0.31, 0.32)
)

comp_table(mean = df_mean, sd = df_sd)

# ...........mean............     ............sd.............
# 1    Species   length   width        Species   length   width
# 2     setosa     5.01    3.43         setosa     0.35    0.38
# 3 versicolor     5.94    2.77     versicolor     0.52    0.31
# 4  virginica     6.59    2.97      virginica     0.64    0.32


comp_table(mean = df_mean, sd = df_sd, id_vars = 'Species')

# ..........     .....mean.....     ......sd......
# 1    Species     length   width     length   width
# 2     setosa       5.01    3.43       0.35    0.38
# 3 versicolor       5.94    2.77       0.52    0.31
# 4  virginica       6.59    2.97       0.64    0.32

tatoo documentation built on Feb. 12, 2018, 5:01 p.m.