I am ordering the categories according to their frequency. What is wrong?
using CategoricalArrays, FreqTables
x = ["a", "b", "c", "c", missing]
cx = CategoricalArray(x)
lvls = names(sort(freqtable(collect(skipmissing(cx))), rev=true))
levels!(cx, lvls, allowmissing=true)
ERROR: LoadError: MethodError: Cannot `convert` an object of type CategoricalVector{String, UInt32, String, CategoricalValue{String, UInt32}, Union{}} to an object of type String