# Defining a factor on DataFrames

**URL:** <https://discourse.julialang.org/t/defining-a-factor-on-dataframes/268>\
**Category:** Statistics\
**Created:** [November 12, 2016, 5:03pm UTC](https://discourse.julialang.org/t/defining-a-factor-on-dataframes/268 "2016-11-12T17:03:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hpoit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hpoit/32/245_2.png) [@hpoit](https://discourse.julialang.org/u/hpoit)\
**Post date:** [November 12, 2016, 5:03pm UTC](https://discourse.julialang.org/t/defining-a-factor-on-dataframes/268/1 "2016-11-12T17:03:20Z")

</div>

Hello! Would anyone know how to define a factor on DataFrames according to

> <https://github.com/liang456/Stanford-Probabilistic-Graphical-Models-Coursera/blob/master/PGM_Programming_Assignment_1/FactorProduct.m#L14>

---

<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:** [November 13, 2016, 10:07am UTC](https://discourse.julialang.org/t/defining-a-factor-on-dataframes/268/2 "2016-11-13T10:07:53Z")

</div>

“Factor” has many different meanings, so I think you’ll have to be more explicit. Though if it’s used in the R sense, have a look at `PooledDataArray` in the DataArrays package. There’s also `CategoricalArray` in the eponymous package, which will be used by the next DataFrames release.
