Select dataframe row by condition of type UnitRange

Hi!
I have a DataFrame and want to select a row by applying e.g. @where from DataFramesMeta package:


5×5 DataFrame
 Row │ RowRange     ColRange   SDV      fracNA   thresh  
     │ UnitRange    UnitRange  Float32  Float32  Float32 
─────┼───────────────────────────────────────────────────
   1 │ 6001:6150    1051:1200  191.841      0.0  504.241
   2 │ 6901:7050    1801:1950  197.487      0.0  520.914
   3 │ 7051:7200    1951:2100  204.885      0.0  536.114
   4 │ 7501:7650    2251:2400  223.123      0.0  556.475
   5 │ 7801:7950    2401:2550  238.504      0.0  536.301
   .
   .
   .
  83 │ 1:150        7651:7800  193.942      0.0    0.0
  84 │ 451:600      7651:7800  189.624      0.0    0.0
  85 │ 151:300      8101:8250  198.577      0.0    0.0

If I run:

@where(tilestats, :RowRange .== 6001:6150)

I get this error:

ERROR: DimensionMismatch("arrays could not be broadcast to a common size; got a dimension with lengths 85 and 150")

Isn’t possible to search for a UnitRange in a DataFrame?

Thanks in advance!
Bjoern

You need a Ref since a unit range is broadcastable

@where(tilestats, :RowRange .==Ref( 6001:6150))
2 Likes

Ahh ok, thanks a lot!