1. Raue, Bioinformatics 31(21), 2015↩︎

2. Kaschek, dMod, 2016 (https://cran.r-project.org/package=dMod)↩︎

# Compose several tables to a new table following a construction pattern

Several tables provided via the "..." argument are composed to a new table. The pattern of the layout is provided as character using Markdown syntax.

compose_IQRtable(..., pattern, just = "tl")

## Arguments

...

one or more tables or single list of tables to be composed. Arguments must be named. The names can be used in "pattern" to reference the table.

pattern

character using the symbols "|" to distinguish between columns and "\n" (or an actual line break) to distinguish between lines. Additional symbols should point to the provided "..." arguments.

just

when tables of different size are composed, each matrix is embedded into a possibly larger matrix to match dimensions of the surrounding tables. "just" is a string to control where matrices are placed within the larger matrix. Possible values are "t" (top), "b" (bottom), "l" (left) and "r" (right) which can be combined, e.g. "tl", "br", etc..

## Value

Matrix, the composition of the single tables.

## Details

A typical pattern would be:

pattern <-

C1 | M11     | M12     |
|         |         |
C2 | M21     | M22     |"

Here, "M11", ..., "M22" can all be matrices of different dimensions. "header1" and "header2" would probably be matrices with one row (not necessarily). "C1" and "C2" would be matrices with on column (not necessarily). The empty row in between will be interpreted as an empty row. Characters in R defined over several lines automatically contain the escape characters "\n" for new lines. One could also write the pattern in one line, although less unititively.

Within the pattern, it is also possible to select parts of a matrix for composition:

pattern <-

"   | M11[1 ,] | header2 |
C1 | M11[-1,] | M12     |"

The single cells of the pattern are parsed and evaluated with the list of "..." argument.

Other IQR Table: IQRtable(), as.data.frame.IQRtable(), as_IQRtable(), cjoin_IQRtable(), composeByRule_IQRtable()

## Author

Daniel Kaschek, IntiQuan

## Examples


M1 <- matrix(letters[1:6], nrow = 2, ncol = 3)
M2 <- matrix(LETTERS[1:6], nrow = 3, ncol = 2)

pattern <-

"n1 | M1 |
|    |
n2 | M2 |
|    |"

mytable <- compose_IQRtable(M1 = M1, M2 = M2,
n1 = "Lower case letters", n2 = "Upper case letters",
pattern = pattern)

print(mytable)
#>    Lower case letters | a | c | e
#>    ------------------------------
#>                       | b | d | f
#>                       |   |   |
#>    Upper case letters | A | D |
#>                       | B | E |
#>                       | C | F |
#>                       |   |   |

pattern <-

" n1 | M1[1, ] |
n2 | M2[, 1] |"

mytable <- compose_IQRtable(M1 = M1, M2 = M2,
n1 = "Lower case letters", n2 = "Upper case letters",
pattern = pattern,
just = "r")

print(mytable)
#>    Lower case letters | a | c | e
#>    ------------------------------
#>    Upper case letters |   |   | A
#>                       |   |   | B
#>                       |   |   | C