# StatsBase, sampling without "putting back"

**URL:** <https://discourse.julialang.org/t/statsbase-sampling-without-putting-back/23367>\
**Category:** Statistics\
**Created:** [April 21, 2019, 8:37am UTC](https://discourse.julialang.org/t/statsbase-sampling-without-putting-back/23367 "2019-04-21T08:37:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gunter\_Faes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunter_faes/32/12580_2.png) [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Post date:** [April 21, 2019, 8:37am UTC](https://discourse.julialang.org/t/statsbase-sampling-without-putting-back/23367/1 "2019-04-21T08:37:35Z")

</div>

Hello,

Using the StatsBase package, it is possible to take samples using various procedures. Seems to me, but only with “put back”. This means that the same sample is taken several times.

Is there a parameter or a procedure that allows me to draw samples without “putting back”?

Of course, I would like to have 30 samples in the end, for example, so I don’t just want to remove the multiple entries.

I am happy if someone can give me a hint!  
Many greetings,  
Guenter

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [April 21, 2019, 8:41am UTC](https://discourse.julialang.org/t/statsbase-sampling-without-putting-back/23367/2 "2019-04-21T08:41:09Z")

</div>

The English term is with/without replacement, and `StatsBase.sample` has a `replace` keyword for it.

---

<div class="post-metadata">

**Author:** ![Gunter\_Faes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunter_faes/32/12580_2.png) [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Post date:** [April 21, 2019, 10:28am UTC](https://discourse.julialang.org/t/statsbase-sampling-without-putting-back/23367/3 "2019-04-21T10:28:39Z")

</div>

It’s working!

```julia
i_Training = sample(i_Zeilen, n_Training, replace = false, ordered = true)

```

Sorry, that was too easy! 😳  
Thank you!
