Skip to contents

Concatenate matrices along the first or second dimension.

Usage

hcat(...)

vcat(...)

Arguments

...

Vectors or matrices.

Value

A matrix formed by combining the ... arguments column-wise (hcat) or row-wise (vcat).

See also

Examples

m1 <- mat("1, 2, 3; 4, 5, 6")
m2 <- mat("7, 8, 9; 10, 11, 12")
hcat(m1, m2) # same as 'bmat("m1, m2")'
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    1    2    3    7    8    9
#> [2,]    4    5    6   10   11   12
vcat(m1, m2) # same as 'bmat("m1; m2")'
#>      [,1] [,2] [,3]
#> [1,]    1    2    3
#> [2,]    4    5    6
#> [3,]    7    8    9
#> [4,]   10   11   12