s = StructArray{NamedTuple{(:a, :b, :c, :d), NTuple{4, Float32}}}((a=[0,1,1,1,2,2,2],b=[0,0,0,0,0,0,0],c=[0,20,10,10,20,20,10],d=[0,6,5,4,3,2,1]))
factors = (a = 0.9, c = 1.2, d=2.0, b=0.2)
How to multiply a with factors?
julia> s * factors
ERROR: MethodError: no method matching *(::StructVector{NamedTuple{(:a, :b, :c, :d), NTuple{4, Float32}}, NamedTuple{(:a, :b, :c, :d), NTuple{4, Vector{Int64}}}, Int64}, ::NamedTuple{(:a, :b, :c, :d), NTuple{4, Float64}})
julia> s .* factors
ERROR: ArgumentError: broadcasting over dictionaries and `NamedTuple`s is reserved
Iteration over keys and rows does also not work: s[2][keys(factors)[1]] gives access to values but does not allow modifying them … Is there a way for accessing and modifying a column of s via the keys of factors? And why this behaviour:
julia> s.a
7-element Vector{Int64}:
0
6
5
4
3
2
1
julia> s.a = s.a * 2
ERROR: type StructArray has no field a
Thanks