How do delete a column from a freqtable?

Hi how’s it going?

I’m using freqtables as a pivot table in Julia, and essentially I want to drop certain columns that I don’t need after computing the freqtable. Here’s an example of a computation straight from the docs.

julia> using FreqTables
julia> x = repeat(["a", "b", "c", "d"], outer=[100]);
julia> y = repeat(["A", "B", "C", "D"], inner=[10], outer=[10]);

julia> freqtable(x, y)
4x4 NamedArrays.NamedArray{Int64,2,Array{Int64,2},Tuple{Dict{ASCIIString,Int64},Dict{ASCIIString,Int64}}}
Dim1 \ Dim2 A  B  C  D 
a           30 20 30 20
b           30 20 30 20
c           20 30 20 30
d           20 30 20 30

Now imagine for some reason, I wanted to get rid of capital D from the freqtable columns, because the counts of capital D mean nothing in my use case.

How would I do so?

Thanks

using DataFrames # exports InvertedIndices.Not
t = freqtable(x, y)
s = t[:, Not("D")]
1 Like

thank you!