-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
The package currently only defines a two-argument show method. This causes two issues. First, the output of repr can't be parsed
julia> Meta.parse(repr(categorical(["placebo"])[1]))
ERROR: ParseError:
# Error @ none:1:33
CategoricalValue{String, UInt32} "placebo"
# └────────┘ ── extra tokens after end of expression
Stacktrace:
[1] #parse#3
@ ./meta.jl:242 [inlined]
[2] parse
@ ./meta.jl:234 [inlined]
[3] parse(str::String; filename::String, raise::Bool, depwarn::Bool)
@ Base.Meta ./meta.jl:276
[4] parse(str::String)
@ Base.Meta ./meta.jl:274
[5] top-level scope
@ REPL[151]:1Second, display of CategoricalArray is overly verbose
julia> [String7("placebo")]
1-element Vector{String7}:
"placebo"
julia> categorical([String7("placebo")])
1-element CategoricalArray{String7,1,UInt32}:
String7("placebo")Changing
CategoricalArrays.jl/src/value.jl
Lines 99 to 111 in 62b85ac
| function Base.show(io::IO, x::CategoricalValue) | |
| if get(io, :compact, false) || | |
| nonmissingtype(get(io, :typeinfo, Any)) === nonmissingtype(typeof(x)) | |
| show(io, unwrap(x)) | |
| else | |
| print(io, typeof(x)) | |
| print(io, ' ') | |
| show(io, unwrap(x)) | |
| if isordered(pool(x)) | |
| @printf(io, " (%i/%i)", levelcode(x), length(pool(x))) | |
| end | |
| end | |
| end |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels