5

The CategoricalArray constructor and the categorical function from CategoricalArrays.jl seem to be nearly identical in behavior:

julia> using CategoricalArrays

julia> x = CategoricalArray(["a", "b", "c"]; ordered=true, levels=["c", "b", "a"])
3-element CategoricalArray{String,1,UInt32}:
 "a"
 "b"
 "c"

julia> y = categorical(["a", "b", "c"]; ordered=true, levels=["c", "b", "a"])
3-element CategoricalArray{String,1,UInt32}:
 "a"
 "b"
 "c"

julia> x == y
true

Is there any notable difference between CategoricalArray and categorical? If they're basically the same, then what's the reason for including the redundant categorical function?

Cameron Bieganek
  • 7,208
  • 1
  • 23
  • 40

1 Answers1

4

categorical supports compress keyword argument as opposed to CategoricalArray.

Bogumił Kamiński
  • 66,844
  • 3
  • 80
  • 107