after reading that
" … filter(ds, cols; [view = false, type = all,...])
is the shortcut for ds[byrow(ds, type, cols; ...), :]
…"
julia> byrow(ds, f, :)# works
3-element Vector{Union{Missing, Bool}}:
true
false
false
I have tried the following expressions, which I would expect to give the same result.
but it is not so, as rightly observed by @monopolynomial
julia> ds[[true,false,false],:]
1×2 Dataset
Row │ x1 x2
│ identity identity
│ Int64? Int64?
─────┼────────────────────
1 │ 1 3
julia> ds[byrow(ds, f, :),:]
ERROR: BoundsError: attempt to access 3×2 Dataset at index [Union{Missing, Bool}[true, false, false], :]
" Naturally, other fun
s supported by byrow
which return a Vector{Bool}
or BitVector
can be used to filter observations, too."
the problem therefore seems to be that byrow (...)
only works with Vector{Bool}
but not with Vector{Union{Missing, Bool}}
this “works”
julia> ds[Bool.(byrow(ds, f, :)),:]
1×2 Dataset
Row │ x1 x2
│ identity identity
│ Int64? Int64?
─────┼────────────────────
1 │ 1 3
the issue seems to be the handling of Union {Missing, T}
types