Skip to content

Installation

If you want to use this package you need to install it first. You can do it using the following commands:

julia
julia> ] # ']' should be pressed
pkg> add DimensionalData

or

julia
julia> using Pkg
julia> Pkg.add("DimensionalData")

Additionally, it is recommended to check the version that you have installed with the status command.

julia
julia> ]
pkg> status DimensionalData

Basics

Start using the package:

julia
using DimensionalData

and create your first DimArray

julia
julia> A = DimArray(rand(4,5), (a=1:4, b=1:5))
4×5 DimArray{Float64, 2}
├──────────────────────────┴─────────────────────── dims ┐
a Sampled{Int64} 1:4 ForwardOrdered Regular Points,
b Sampled{Int64} 1:5 ForwardOrdered Regular Points
└────────────────────────────────────────────────────────┘
  1         2         3          4          5
 1    0.9063    0.253849  0.0991336  0.0320967  0.581912
 2    0.443494  0.334152  0.125287   0.350546   0.311448
 3    0.745673  0.427328  0.692209   0.930332   0.121148
 4    0.512083  0.867547  0.136551   0.959434   0.20453

or

julia
julia> C = DimArray(rand(Int8, 10), (alpha='a':'j',))
10-element DimArray{Int8, 1}
├──────────────────────────────┴───────────────── dims ┐
alpha Categorical{Char} 'a':1:'j' ForwardOrdered
└──────────────────────────────────────────────────────┘
 'a'    19
 'b'  -124
 'c'    -3
 'd'    96
 'e'    99
 'f'    32
 'g'    -2
 'h'    98
 'i'   -15
 'j'    69

or something a little bit more complicated:

julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
 31   5  105  122  91  75  115  12   3  98
 53  78  111   18   8  27   16  22  93  78

[:, :, 2] =
 80  42  53   49  111  100  32  81  117  100
 14  99  39  103   79   59  50  82   48   96

[:, :, 3] =
 78  54  88  36  60    4  42  70  34  77
 20  11  95  32   0  107  68  67  73  36
julia
julia> B = DimArray(data, (channel=[:left, :right], time=1:10, iter=1:3))
2×10×3 DimArray{Int8, 3}
├──────────────────────────┴─────────────────────────────── dims ┐
channel Categorical{Symbol} [:left, :right] ForwardOrdered,
time Sampled{Int64} 1:10 ForwardOrdered Regular Points,
iter Sampled{Int64} 1:3 ForwardOrdered Regular Points
└────────────────────────────────────────────────────────────────┘
[:, :, 1]
       1   2    3    4   5   6    7   8   9  10
  :left   31   5  105  122  91  75  115  12   3  98
  :right  53  78  111   18   8  27   16  22  93  78