Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UndefVarError: len not defined in make_idx(data, pair::Pair, last_val) #185

Open
anandijain opened this issue Jan 26, 2023 · 1 comment
Open

Comments

@anandijain
Copy link

julia>     x = getsimulationresultsalldata(baseline_data, treatment_data);
ERROR: UndefVarError: `len` not defined
Stacktrace:
  [1] make_idx(data::Vector{Any}, pair::Pair{String, Matrix{Float64}}, last_val::Int64)
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:165
  [2] make_idx(data::Vector{Any}, nt::Dict{Symbol, Pair{String}}, last_val::Int64)
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:157
  [3] make_carray_args(A::Type{Vector}, nt::Dict{Symbol, Pair{String}})
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:147
  [4] make_carray_args(nt::Dict{Symbol, Pair{String}})
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:139
  [5] ComponentArray(nt::Dict{Symbol, Pair{String}})
    @ ComponentArrays ~/.julia/packages/ComponentArrays/GsPr2/src/componentarray.jl:63****

im on 0.13.6
i can't show the rest of the trace but the make_idx function does look wrong

function make_idx(data, pair::Pair, last_val)
    data, ax = make_idx(data, pair.second, last_val)
    return (data, ViewAxis(last_val:(last_val+len-1), Axis(pair.second)))
end
@jonniedie
Copy link
Owner

Oh, yeah, that's wrong. Would you mind giving me an example I could run on my end? It should work if we change that to

function make_idx(data, pair::Pair, last_val)
    data, ax = make_idx(data, pair.second, last_val)
    len = recursive_length(data)
    return (data, ViewAxis(last_val:(last_val+len-1), Axis(pair.second)))
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants