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.746586  0.586749   0.477645  0.705747  0.579592
 2    0.819201  0.121813   0.804193  0.991961  0.803867
 3    0.954159  0.137766   0.123538  0.740841  0.541886
 4    0.845895  0.0508083  0.74002   0.229042  0.776189

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'    93
 'b'    44
 'c'    -9
 'd'    29
 'e'     2
 'f'   -92
 'g'    89
 'h'    18
 'i'  -116
 'j'  -120

or something a little bit more complicated:

julia
julia> data = rand(Int8, 2, 10, 3) .|> abs
2×10×3 Array{Int8, 3}:
[:, :, 1] =
 91  95  60  68  126  62  15  99  53  22
 17  19  84  41   81  78  27  53  22  31

[:, :, 2] =
 119  100  88  42  113  12  86  77  117   40
  50   53   9  40   34  93   0  16  122  114

[:, :, 3] =
 92   94  20   9  113   17  56  123   81   58
 33  102  72  12    9  114  94   93  102  101
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   91  95  60  68  126  62  15  99  53  22
  :right  17  19  84  41   81  78  27  53  22  31