# Should we add sm as a short form of skipmissing

**URL:** https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610
**Category:** Statistics
**Tags:** question
**Created:** [June 11, 2022, 10:10pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610 "2022-06-11T22:10:23Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)
#### Post date: [June 11, 2022, 10:10pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/1 "2022-06-11T22:10:23Z")

</div>

Do you think `const sm = skipmissing` should be added and exported from Missings.jl?  
The point is that then `mean(skipmissing(x))` would be abbreviated to `mean(sm(x))`. Given `skipmissing` is often needed I would propose to consider adding such a definition. Of course it is easy to add `const sm = skipmissing` in your code, but I think that it is important to have such definition as a standard if we agreed to it (then it would be consistently known and recognized by everyone).

_Poll ([view on site](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/1))_

---

<div class="post-metadata">

### Author: ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)
#### Post date: [June 12, 2022, 2:45am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/2 "2022-06-12T02:45:28Z")

</div>

I’d like to see the yes and no votes broken down by whether you use `skipmissing` or not.

---

<div class="post-metadata">

### Author: ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)
#### Post date: [June 12, 2022, 2:50am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/3 "2022-06-12T02:50:05Z")

</div>

Ironically, I do not use it and voted “yes”.

---

<div class="post-metadata">

### Author: ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)
#### Post date: [June 12, 2022, 3:11am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/4 "2022-06-12T03:11:02Z")

</div>

Although I like the thinking, I personally find it obfuscatory to what the `sm` function would actually do as opposed to `skipmissing` being explicit and for that reason, I vote no.  
Especially as a frequent user of `skipmissing` in a lot of data analysis.  
Although, this could be a vestigial paradigm from my days working in Python regularly.

The notion of having abbreviations is nice and ergonomic however.  
Wonder if there is something there that could go into a separate package?

---

<div class="post-metadata">

### Author: ![ianshmean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ianshmean/32/216042_2.png) [@ianshmean](https://discourse.julialang.org/u/ianshmean)
#### Post date: [June 12, 2022, 3:19am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/5 "2022-06-12T03:19:15Z")

</div>

Instead of `sm`, what about `here`?  
I think it might be a fair antonym of `missing` in this context?

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [June 12, 2022, 5:38am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/6 "2022-06-12T05:38:30Z")

</div>

`sm` is probably a short variable name that users won’t be able to use anymore? It might be better in this case something less short like `skipm`

---

<div class="post-metadata">

### Author: ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)
#### Post date: [June 12, 2022, 6:39am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/7 "2022-06-12T06:39:21Z")

</div>

Thank you all for the feedback. It is really valuable. Assuming, in relation to what @jlapeyre commented, that many `skipmissing` users voted it seems that the initial design decision (to be explicit with naming) is something people like (this is exactly what we wanted to confirm).

As an additional note, related to what @rafael.guerra has written, `skipmissing` in practice is written as `skipm<tab>` taking advantage of autocompletion (and it looks like users find this acceptable).

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [June 12, 2022, 7:29am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/8 "2022-06-12T07:29:12Z")

</div>

I’ve been thinking about using the question mark for missing related functionality. Not sure if skipmissing would work with that but at least replacing missings. Because `nothing` and `missing` serve similar purposes maybe one would need two syntax variants:

```julia
could_be_missing ?m replacement_value 
could_be_nothing ? replacement_value

```

Or maybe with a double `??`

---

<div class="post-metadata">

### Author: ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)
#### Post date: [June 12, 2022, 7:38am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/9 "2022-06-12T07:38:44Z")

</div>

@jules: use `coalesce` for this with `missing` and `something` for `nothing`.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [June 12, 2022, 8:19am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/10 "2022-06-12T08:19:35Z")

</div>

I know but those are eager and longer. I always liked the ? syntax in Swift or Javascript, for unpacking things and handling nothings in a smooth way

---

<div class="post-metadata">

### Author: ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)
#### Post date: [June 12, 2022, 8:33am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/11 "2022-06-12T08:33:06Z")

</div>

how about `mean(↷(x))` althought it looks better in the regular font ↷

j/k 🙂

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [June 12, 2022, 1:14pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/12 "2022-06-12T13:14:01Z")

</div>

> [@bkamins](#):
>
> exported from Missings.jl?

What does this mean? Would this be exported from Base, or do you have to `using Missings`?

---

<div class="post-metadata">

### Author: ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)
#### Post date: [June 12, 2022, 1:32pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/13 "2022-06-12T13:32:59Z")

</div>

> [@DNF](#):
>
> Would this be exported from Base, or do you have to `using Missings`?

It means it would be defined in Missings.jl and only made available if you did `using Missings` or any package that re-exports Missings.jl.

However, given the discussion above I think that the case is closed - it will not be added.

---

<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: [June 12, 2022, 2:07pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/14 "2022-06-12T14:07:56Z")

</div>

Could be good for [MissingsAsFalse.jl](https://github.com/pdeffebach/MissingsAsFalse.jl).

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [June 12, 2022, 2:49pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/15 "2022-06-12T14:49:37Z")

</div>

Would need Julia’s syntax support first though.

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [June 12, 2022, 6:57pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/16 "2022-06-12T18:57:17Z")

</div>

> [@jules](#):
>
> those are eager

There’s `@something` in Base for a lazy version now. Maybe `@coalesce` could be added too.

---

<div class="post-metadata">

### Author: ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)
#### Post date: [June 12, 2022, 9:30pm UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/17 "2022-06-12T21:30:12Z")

</div>

`@coalesce` has been added in 1.7 like `@something`. 🙂

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [June 13, 2022, 5:16am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/18 "2022-06-13T05:16:58Z")

</div>

Hm yes, it’s good to have that macro. But somehow it still feels like Missing and Nothing in Julia are not really given the special treatment they deserve. There is basically no syntax sugar afforded to working with them, even though handling missing or nothing is such a commonplace task. Maybe the problem is that we have both but standard syntax sugar like `?` has only one variant.

Things I’d like to see are option like types such as `String?`, unpacking syntax like `container?.field` or unpacking such as `possible ?? default`.

---

<div class="post-metadata">

### Author: ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)
#### Post date: [June 13, 2022, 7:02am UTC](https://discourse.julialang.org/t/should-we-add-sm-as-a-short-form-of-skipmissing/82610/19 "2022-06-13T07:02:12Z")

</div>

How about hinting the users at the possibility of aliases in the docs?  
`import Base: skipmissing as sm`
