Skip to contents

This function combines instances of matrix, data.frame or DataFrame objects into a single instance adding eventually missing columns (filling them with NAs).

Usage

rbindFill(...)

Arguments

...

2 or more: matrix, data.frame or DataFrame.

Value

Depending on the input a single matrix, data.frame or DataFrame.

Note

rbindFill might not work if one of the columns contains S4 classes.

See also

Other helper functions for developers: between(), isPeaksMatrix(), validPeaksMatrix(), vapply1c(), which.first()

Author

Johannes Rainer, Sebastian Gibb

Examples

## Combine matrices
a <- matrix(1:9, nrow = 3, ncol = 3)
colnames(a) <- c("a", "b", "c")
b <- matrix(1:12, nrow = 3, ncol = 4)
colnames(b) <- c("b", "a", "d", "e")
rbindFill(a, b)
#>      a b  c  d  e
#> [1,] 1 4  7 NA NA
#> [2,] 2 5  8 NA NA
#> [3,] 3 6  9 NA NA
#> [4,] 4 1 NA  7 10
#> [5,] 5 2 NA  8 11
#> [6,] 6 3 NA  9 12
rbindFill(b, a, b)
#>       b a  d  e  c
#>  [1,] 1 4  7 10 NA
#>  [2,] 2 5  8 11 NA
#>  [3,] 3 6  9 12 NA
#>  [4,] 4 1 NA NA  7
#>  [5,] 5 2 NA NA  8
#>  [6,] 6 3 NA NA  9
#>  [7,] 1 4  7 10 NA
#>  [8,] 2 5  8 11 NA
#>  [9,] 3 6  9 12 NA