safeColumnBind | R Documentation |
If x1
is NULL x2
is returned otherwise cbind(x1, x2)
safeColumnBind(x1, x2)
x1 |
first object to be passed to |
x2 |
second object to be passed to |
result of cbind(x1, x2)
or x2
if x1
is NULL
.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.