CombineRows {DataVisualizations} | R Documentation |
Combine matrices of various lengths
Description
Combine arbitrary matrices of data, filling in missing columns with NaN
Usage
CombineRows(...,na.rm=FALSE)
Arguments
... |
First argument is a matrix usually with named columns, thereafter either matrices or d vectors of arbitrary lengths, see example |
na.rm |
boolean: FALSE: fills with NaN TRUE: filles with zeros |
Details
Robust alternative to rbind
that fills missing values with #NaN, tries to match given column names
if matrices are inserted otherwise fills up the missing columns at the end.
The first argument has to be a matrix. It is assumed that this matrix has to be filled up and other arguments or not of bigger size than d columns. Otherwiese the further elements stored in columns >d are ignored.
Value
matrix of dimensionality of n x d with n beeing the number of rows of the first argument and d the number columns of the first argument given as input
Author(s)
Michael Thrun
See Also
CombineRows
Examples
matrix_pattern=cbind(c(1,2,3),c(4,5,6),c(7,8,9))
CombineRows(matrix_pattern,c(1),c(2,3))
CombineRows(matrix_pattern,cbind(c(1,2,3),c(4,5,6)))