naRbind: Combine R Objects with different length by Rows or Columns

View source: R/rbindNA.R

naRbindR Documentation

Combine R Objects with different length by Rows or Columns

Description

Take a sequence of vector, matrix or data-frame arguments and combine by columns or rows, respectively. If the length of the R objects differ they are filled with NAs.

Usage

naRbind(..., deparse.level = 1)

Arguments

...

A sequence of vector, matrix or data-frame to bind

deparse.level

Integer controlling the construction of labels in the case of non-matrix-like arguments (for the default method): deparse.level = 0 constructs no labels; the default, deparse.level = 1 or 2 constructs labels from the argument names, see the 'Value' section below.

Details

The code is based on the rbind() function.

Value

For the default method, a matrix combining the ... arguments column-wise or row-wise. (Exception: if there are no inputs or all the inputs are NULL, the value is NULL.)

The type of a matrix result determined from the highest type of any of the inputs in the hierarchy raw < logical < integer < double < complex < character < list .

See Also

cbind or rbind documentation.

Examples

# Vector
naRbind(1:10, 1:20)

# Matrix
naRbind(matrix(1:10, ncol = 2), matrix(1:20, ncol = 2), matrix(1:30, ncol = 3))

# Data.frame
naRbind(data.frame(x=1:10, y=1:10, c=1:10), data.frame(c=1:20, d=1:20))


GranadoIgor/miscellaneousR documentation built on Sept. 20, 2023, 12:34 p.m.