tonyhffong / TermWin.jl

ncurses based data navigators
Other
26 stars 11 forks source link

`@compat` and `convert` errors #9

Open tshort opened 9 years ago

tshort commented 9 years ago

Tony, I get the following when trying examples from your README:

julia> tshow( df;
           colorder = [ :EnrlTot, :Teachers, :Computer, :TestScr, :CompStu, "*" ],
           pivots = [ :County, :top5districts, :District ],
           initdepth = 2,
           aggrHints = @compat(Dict{Any,Any}(
               :TestScr => :( mean( :_, weights(:EnrlTot) ) ),
               :ExpnStu => :( mean( :_, weights(:EnrlTot) ) ),
               :CompStu => :( mean( :_, weights(:EnrlTot) ) ),
               :Str     => :( mean( :_, weights(:EnrlTot) ) )
               ) ),
           calcpivots = @compat( Dict{Symbol,Any}(
               :CountyStrBuckets     => CalcPivot( :(discretize( :Str, [ 14,16,18,20,22,24 ], rank = true, compact = true )), :County ),
               :CountyTestScrBuckets => CalcPivot( :(discretize( :TestScr, [ 600, 620, 640, 660, 680, 700],
                                           label = "score", rank = true, compact = false, reverse = true ) ), :County ),
               :top5districts        => CalcPivot( :(topnames( :District, :TestScr, 5 ) ) )
               ) ),
           views = [
               @compat(Dict{Symbol,Any}( :name => "ByStr",       :pivots => [ :CountyStrBuckets, :County, :District] ) ),
               @compat(Dict{Symbol,Any}( :name => "ByTestScr",   :pivots => [ :CountyTestScrBuckets, :County, :District] ) ),
               @compat(Dict{Symbol,Any}( :name => "Top5Schools", :pivots => [ :top5districts, :County ] ) )
           ],
           )
ERROR: @compat not defined

julia> tshow(df)
ERROR: `convert` has no method matching convert(::Type{TermWin.TwMultiSelectData}, ::Array{UTF8String,1}, ::Array{Symbol,1})
 in call at base.jl:34
 in newTwMultiSelect at /home/tshort/.julia/v0.4/TermWin/src/twmultiselect.jl:55
 in injectTwDfTable at /home/tshort/.julia/v0.4/TermWin/src/twdftable.jl:845
 in inject at /home/tshort/.julia/v0.4/TermWin/src/twtypes.jl:80
 in activateTwScreen at /home/tshort/.julia/v0.4/TermWin/src/twscreen.jl:237
 in activateTwObj at /home/tshort/.julia/v0.4/TermWin/src/twobj.jl:179
 in activateTwObj at /home/tshort/.julia/v0.4/TermWin/src/twobj.jl:178
 in tshow at /home/tshort/.julia/v0.4/TermWin/src/TermWin.jl:315

In the tshow(df) case, the error happens with I hit p.

This is with Julia 0.3.3 and Julia 0.4 (probably from a week ago) using the devel version of TermWin.

tonyhffong commented 9 years ago

I probably have a typo somewhere. Meanwhile could you try include( joinpath( Pkg.dir("TermWin"), "test/dataframe.jl" ) ) It works on my 0.3.3.

tonyhffong commented 9 years ago

It's a bit odd. Could you try updating your TermWin package to make sure it's the latest? the error message doesn't make much sense to me so far.

tonyhffong commented 9 years ago

Oh sorry! I know what the problem was. Fixing. @compat macro is from the Compat.jl package.