safeColumnBind: "Safe" version of cbind.

View source: R/column.R

safeColumnBindR Documentation

"Safe" version of cbind.

Description

If x1 is NULL x2 is returned otherwise cbind(x1, x2)

Usage

safeColumnBind(x1, x2)

Arguments

x1

first object to be passed to cbind

x2

second object to be passed to cbind

Value

result of cbind(x1, x2) or x2 if x1 is NULL.

Examples

x1 <- NULL
  
for (i in 1:3) {
  
  x2 <- data.frame(a = 1:3, b = rnorm(3))
  x1 <- safeColumnBind(x1, x2)
  
  # using cbind would result in an error:
  # x1 <- cbind(x1, x2)
}
  
x1


KWB-R/kwb.utils documentation built on April 28, 2023, 2:46 p.m.