nalimilan / FreqTables.jl

Frequency tables in Julia
Other
90 stars 19 forks source link

CategoricalArray fixes #46

Open nalimilan opened 4 years ago

nalimilan commented 4 years ago

Fix mixing CategoricalArray with other kinds of arrays, which failed due to problems with how NamedArrays handles CategoricalArray dimnames: now we always unwrap categorical values when creating dimension names.

Fix the type of the dimnames vector when only CategoricalArrays are passed: before this it was always Union{T, Missing}. Change it to always use the same eltype as the input, which is consistent with other AbstractArrays.

Fixes https://github.com/nalimilan/FreqTables.jl/issues/45.

nalimilan commented 4 years ago

Actually, unwrapping categorical values may not be a good idea, as that makes it impossible to index the table with CategoricalValue{Int} (other than via Name). I've filed https://github.com/davidavdav/NamedArrays.jl/issues/84 to allow using CategoricalArray names instead.

nalimilan commented 4 years ago

The last commit reverts the unwrapping of categorical values. Tests will fail until the new NamedArrays release.