This functions works very similar to well-known base `cbind` or `rbind` function. However, there is one big difference between these functions. If you pass a vector, each value will be get individually.
col_bind(...) row_bind(...)
... | single values, vectors, matrices or data.frames |
---|
a matrix being a product of matrix/vector/values binding
#> [,1] [,2] [,3] [,4] [,5] #> [1,] 1 2 3 4 5col_bind(1,2,3,4,5)#> [,1] [,2] [,3] [,4] [,5] #> [1,] 1 2 3 4 5#> [,1] #> [1,] 1 #> [2,] 2 #> [3,] 3 #> [4,] 4 #> [5,] 5col_bind(1:5)#> [,1] [,2] [,3] [,4] [,5] #> [1,] 1 2 3 4 5#> Warning: number of rows of result is not a multiple of vector length (arg 3)#> [,1] [,2] [,3] [,4] [,5] #> [1,] 3 3 3 0.33 4 #> [2,] 3 3 3 0.33 5 #> [3,] 3 3 3 0.33 6#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] #> [1,] 3 3 3 0.33 4 5 6 7 #> [2,] 3 3 3 0.33 4 5 6 7 #> [3,] 3 3 3 0.33 4 5 6 7#> [,1] #> [1,] 1 #> [2,] 2 #> [3,] 3 #> [4,] 4 #> [5,] 5row_bind(1,2,3,4,5)#> [,1] #> [1,] 1 #> [2,] 2 #> [3,] 3 #> [4,] 4 #> [5,] 5#> [,1] [,2] [,3] [,4] [,5] #> [1,] 1 2 3 4 5row_bind(1:5)#> [,1] #> [1,] 1 #> [2,] 2 #> [3,] 3 #> [4,] 4 #> [5,] 5#> Warning: number of columns of result is not a multiple of vector length (arg 3)#> [,1] [,2] [,3] #> [1,] 3.00 3.00 3.00 #> [2,] 3.00 3.00 3.00 #> [3,] 3.00 3.00 3.00 #> [4,] 0.33 0.33 0.33 #> [5,] 4.00 5.00 6.00#> [,1] [,2] [,3] #> [1,] 3.00 3.00 3.00 #> [2,] 3.00 3.00 3.00 #> [3,] 3.00 3.00 3.00 #> [4,] 0.33 0.33 0.33 #> [5,] 4.00 4.00 4.00 #> [6,] 5.00 5.00 5.00 #> [7,] 6.00 6.00 6.00 #> [8,] 7.00 7.00 7.00