co-analysis / a11ytables

R package: generate best-practice stats spreadsheets for publication
https://co-analysis.github.io/a11ytables/
Other
40 stars 3 forks source link

Convert factors to character in tables components? #113

Closed matt-dray closed 1 month ago

matt-dray commented 7 months ago

Users provide dataframes to the tables argument of create_a11ytable(). I don't think there's any handling of factor-class columns.

  1. Check if factor-class columns break anything.
  2. If yes, likely need to coerce those columns to character (may need to handle 'numeric-looking columns' differently to 'character-looking columns').
  3. Test.

Might be linked to #110.

matt-dray commented 1 month ago

So: we check for the max 'column width' with nchar() to decide if the column should be widened. As per the docs for the x argument of nchar(), 'giving a factor is an error', so we should coerce to character first.