I just wrote the following function on discourse which converts an arbitrary NamedArray to a DataFrame
julia> function iteratenames(t)
dns = (:count, dimnames(t)...)
nms = names(t)
out = map(vec(CartesianIndices(t))) do i
val = t[i]
indices = ntuple(length(nms)) do j
nms[j][i[j]]
end
vals = (val, indices...)
NamedTuple{dns}(vals)
end
DataFrame(out)
end
We could probably implement a small conversion to something that satisfied the Tables.jl interface and make it easier for people to do crosstabs that return tables.
I just wrote the following function on discourse which converts an arbitrary
NamedArray
to aDataFrame
We could probably implement a small conversion to something that satisfied the Tables.jl interface and make it easier for people to do crosstabs that return tables.