co-analysis / a11ytables

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

'Sheet types' could use OOP for flexibility #87

Closed matt-dray closed 9 months ago

matt-dray commented 2 years ago

The argument sheet_type to create_a11ytable() can be cover, contents, notes or tables (one per sheet). This information dictates how generate_workbook() will apply styles and structure to a given sheet.

At present, the package is constrained to these four types and the code of generate_workbook() is not particularly elegant or easily expanded for new potential sheet types.

Would it be better if sheet types used OOP under the hood? A parent class could apply style and structure to common elements like the sheet title. Child classes could have methods specific to each sheet type.

The opinionated set of current sheet types helps keep things simple and generic, but maybe the options should be expanded. OOP might make it easier on the dev side.

matt-dray commented 9 months ago

I don't think this is feasible with {a11ytables} as-is, maybe it could be part of an {a11ytables2}.