rafaqz / DimensionalData.jl

Named dimensions and indexing for julia arrays and other data
https://rafaqz.github.io/DimensionalData.jl/stable/
MIT License
271 stars 38 forks source link

Supporting `vcat` and `hcat` #453

Closed sethaxen closed 1 year ago

sethaxen commented 1 year ago

Currently vcat and hcat for DimArray inputs return Arrays, when they should return DimArrays:

julia> x = DimArray(randn(5, 2), (X(1:5), Y(1:2)));

julia> vcat(x, x)
10×2 Matrix{Float64}:
  0.342829    2.26562
 -0.0676149   0.397851
  0.0497348   1.01321
 -0.141629   -2.71782
 -0.949297   -0.60709
  0.342829    2.26562
 -0.0676149   0.397851
  0.0497348   1.01321
 -0.141629   -2.71782
 -0.949297   -0.60709

julia> hcat(x, x)
5×4 Matrix{Float64}:
  0.342829    2.26562    0.342829    2.26562
 -0.0676149   0.397851  -0.0676149   0.397851
  0.0497348   1.01321    0.0497348   1.01321
 -0.141629   -2.71782   -0.141629   -2.71782
 -0.949297   -0.60709   -0.949297   -0.60709