# What is a Pooled Array? And my answer

**URL:** <https://discourse.julialang.org/t/what-is-a-pooled-array-and-my-answer/6467>\
**Category:** New to Julia\
**Created:** [October 16, 2017, 12:29pm UTC](https://discourse.julialang.org/t/what-is-a-pooled-array-and-my-answer/6467 "2017-10-16T12:29:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [October 16, 2017, 12:29pm UTC](https://discourse.julialang.org/t/what-is-a-pooled-array-and-my-answer/6467/1 "2017-10-16T12:29:47Z")

</div>

I was reading [https://github.com/JuliaComputing/PooledArrays.jl](https://github.com/JuliaComputing/PooledArrays.jl) which describes a PooledArray. I tried to follow the source code and looked at the constructor, I gather that a pool is the same as a level in R/Stats speaking which is the same as a category in SAS/stats speak.

In uni stats courses it’s referred to as factor levels, which are basically the unique possibles values in a categorical variable. Also in a pooledarray representation there is a ref which is of integer type _RA_, it acts as pointers to the list of possible values very much like how R’s factors work.

---

<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:** [October 16, 2017, 12:51pm UTC](https://discourse.julialang.org/t/what-is-a-pooled-array-and-my-answer/6467/2 "2017-10-16T12:51:19Z")

</div>

That (ordered levels) is one application, but the other main feature is simply compression. For unordered levels, see  
[https://github.com/JuliaArrays/IndirectArrays.jl](https://github.com/JuliaArrays/IndirectArrays.jl)

I think that whenever possible, it is advantageous to separate data structures (“this is what it does”) from applications (“this is what you use it for”), since there may be multiple uses that make sense. This keeps things modular.

---

<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:** [October 16, 2017, 5:05pm UTC](https://discourse.julialang.org/t/what-is-a-pooled-array-and-my-answer/6467/3 "2017-10-16T17:05:09Z")

</div>

If you’re looking for an equivalent of R factors, rather use `CategoricalArrays`:  
[https://github.com/JuliaData/CategoricalArrays.jl](https://github.com/JuliaData/CategoricalArrays.jl)

PooledArrays’ main purpose is compression, so it doesn’t have anything specific for categorical data. Which package is more appropriate depends on what you need to do.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [October 16, 2017, 5:31pm UTC](https://discourse.julialang.org/t/what-is-a-pooled-array-and-my-answer/6467/4 "2017-10-16T17:31:00Z")

</div>

Is the distinction between those three packages documented somewhere?

---

<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:** [October 16, 2017, 5:40pm UTC](https://discourse.julialang.org/t/what-is-a-pooled-array-and-my-answer/6467/5 "2017-10-16T17:40:34Z")

</div>

Not that I know of.
