# Split-apply-combine error

**URL:** <https://discourse.julialang.org/t/split-apply-combine-error/58506>\
**Category:** New to Julia\
**Created:** [April 3, 2021, 2:42pm UTC](https://discourse.julialang.org/t/split-apply-combine-error/58506 "2021-04-03T14:42:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Donald\_Lee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/donald_lee/32/10622_2.png) [@Donald\_Lee](https://discourse.julialang.org/u/Donald_Lee)\
**Post date:** [April 3, 2021, 2:42pm UTC](https://discourse.julialang.org/t/split-apply-combine-error/58506/1 "2021-04-03T14:42:32Z")

</div>

Am I doing something wrong here with the quantile line? The 3rd line with `mean` runs, but I’m getting the `empty data vector` error with the 2nd line.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/0/007af262e8f91d81637312a016d0f61d6b9d1570.png)

This is ultimately the way I want to run it, but it’s giving the `empty data vector` error here as well:

![image](https://global.discourse-cdn.com/julialang/original/3X/c/7/c7c9562069f55c338565093b328aad2a1e82c751.png)

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [April 3, 2021, 3:01pm UTC](https://discourse.julialang.org/t/split-apply-combine-error/58506/2 "2021-04-03T15:01:22Z")

</div>

Hard to say for certain without a minimum working example, but it looks like this:

```julia
julia> using DataFrames

julia> df = DataFrame(group = [1,1,2,2], val = [2, 3, missing, missing])
4×2 DataFrame
 Row │ group val     
     │ Int64 Int64?  
─────┼────────────────
   1 │ 1 2
   2 │ 1 3
   3 │ 2 missing 
   4 │ 2 missing 

julia> combine(groupby(df, :group), :val => (x -> quantile(x, 0.5)) ∘ skipmissing)
ERROR: ArgumentError: empty data vector

```

i.e. you have groups which don’t have any `dv_plasma` observations, so there’s no data left to calculate the quantile from after `skipmissing`
