# Select dataframe row by condition of type UnitRange

**URL:** https://discourse.julialang.org/t/select-dataframe-row-by-condition-of-type-unitrange/51259
**Category:** General Usage
**Tags:** dataframes
**Created:** [December 4, 2020, 3:59pm UTC](https://discourse.julialang.org/t/select-dataframe-row-by-condition-of-type-unitrange/51259 "2020-12-04T15:59:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Bjorn\_De](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjorn_de/32/13174_2.png) [@Bjorn\_De](https://discourse.julialang.org/u/Bjorn_De)
#### Post date: [December 4, 2020, 3:59pm UTC](https://discourse.julialang.org/t/select-dataframe-row-by-condition-of-type-unitrange/51259/1 "2020-12-04T15:59:34Z")

</div>

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

```julia

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:

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

```

I get this error:

```julia
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

---

<div class="post-metadata">

### Author: ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)
#### Post date: [December 4, 2020, 4:36pm UTC](https://discourse.julialang.org/t/select-dataframe-row-by-condition-of-type-unitrange/51259/2 "2020-12-04T16:36:14Z")

</div>

You need a `Ref` since a unit range is broadcastable

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

```

---

<div class="post-metadata">

### Author: ![Bjorn\_De](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjorn_de/32/13174_2.png) [@Bjorn\_De](https://discourse.julialang.org/u/Bjorn_De)
#### Post date: [December 4, 2020, 4:37pm UTC](https://discourse.julialang.org/t/select-dataframe-row-by-condition-of-type-unitrange/51259/3 "2020-12-04T16:37:10Z")

</div>

Ahh ok, thanks a lot!
