Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify columns as strings? #44

Closed
devmotion opened this issue Oct 1, 2024 · 1 comment · Fixed by #63
Closed

Specify columns as strings? #44

devmotion opened this issue Oct 1, 2024 · 1 comment · Fixed by #63

Comments

@devmotion
Copy link
Contributor

Related to #43, I noticed that columns can't be specified as strings:

julia> table_one(pkpain_df, names(pkpain_df); show_n=true)
ERROR: MethodError: no method matching SummaryTables.Analysis(::String, ::DataFrame)

Closest candidates are:
  SummaryTables.Analysis(::Any, ::Any, ::Any)
   @ SummaryTables ~/.julia/packages/SummaryTables/WKLcB/src/table_one.jl:82
  SummaryTables.Analysis(::Symbol, ::DataFrame)
   @ SummaryTables ~/.julia/packages/SummaryTables/WKLcB/src/table_one.jl:87
  SummaryTables.Analysis(::Symbol, ::Any, ::DataFrame)
   @ SummaryTables ~/.julia/packages/SummaryTables/WKLcB/src/table_one.jl:96
  ...

Stacktrace:
 [1] (::SummaryTables.var"#32#33"{DataFrame})(x::String)
   @ SummaryTables ~/.julia/packages/SummaryTables/WKLcB/src/table_one.jl:117
 [2] iterate
   @ ./generator.jl:47 [inlined]
 [3] _collect
   @ ./array.jl:854 [inlined]
 [4] collect_similar
   @ ./array.jl:763 [inlined]
 [5] map
   @ ./abstractarray.jl:3285 [inlined]
 [6] make_analyses
   @ ~/.julia/packages/SummaryTables/WKLcB/src/table_one.jl:117 [inlined]
 [7] table_one(table::DataFrame, analyses::Vector{…}; groupby::Vector{…}, show_overall::Bool, show_pvalues::Bool, show_tests::Bool, show_confints::Bool, show_n::Bool, compare_groups::Vector{…}, nonnormal::Vector{…}, minmax::Vector{…}, tests::@NamedTuple{}, combine::MultipleTesting.Fisher, sort::Bool, celltable_kws::@Kwargs{})
   @ SummaryTables ~/.julia/packages/SummaryTables/WKLcB/src/table_one.jl:263
 [8] top-level scope
   @ REPL[120]:1
Some type information was truncated. Use `show(err)` to see complete types.

In my use case this would have been convenient (arguably names(df) is a bit simpler than propertynames(df)).

@jkrumbiegel
Copy link
Collaborator

Good point, I'll add the option to use strings as well. When you have column names with spaces (I guess you shouldn't but...), symbols are also not easy to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants