There seems to be a number of rules for tab titles (e.g. this unofficial page). I'm not sure if all spreadsheet programs agree on these rules, so may be better to be more conservative about any choices made.
I think {openxlsx} automatically handles autoconversion, but it would be nice for {a11ytable} to do it so that it won't be a surprise when the output xlsx has slightly different tab names.
So:
only A-Z, 0-9 (there are exceptions, but I think stricter is better here)
replace blanks with underscore
can't exceed 31 characters
Could warn:
when a name has been changed automatically (e.g. user inputs 'Table 1' and it gets auto-converted to 'Table_1')
the specific rules that have been broken (probably not, easier to have a generic sentence like 'some table names have been adjusted to meet the requirements' or whatever)
if a tabname goes over a certain length (31 is max, but it's optimal to keep them relatively short, maybe 15 characters max?)
note that the package already handles the requirement that two tab names must be unique.
Could insert function .clean_tab_titles() into new_a11ytable() with a warning if any tab_titles have changed. Will also need a standalone warning in .warn_a11ytable() so that users ofas_a11ytable() also gets a warning. (~But wouldn't this then mean there'd be two separate warnings supplied to people who use new_a11ytable(), i.e. once when the tab_titles are cleaned and again in .warn_a11ytable()?~ No, obviously not, because they've been cleaned by the time they get to .warn_a11ytable()).
There seems to be a number of rules for tab titles (e.g. this unofficial page). I'm not sure if all spreadsheet programs agree on these rules, so may be better to be more conservative about any choices made.
I think {openxlsx} automatically handles autoconversion, but it would be nice for {a11ytable} to do it so that it won't be a surprise when the output xlsx has slightly different tab names.
So:
Could warn:
Could insert function
.clean_tab_titles()
intonew_a11ytable()
with a warning if any tab_titles have changed. Will also need a standalone warning in.warn_a11ytable()
so that users ofas_a11ytable()
also gets a warning. (~But wouldn't this then mean there'd be two separate warnings supplied to people who usenew_a11ytable()
, i.e. once when the tab_titles are cleaned and again in.warn_a11ytable()
?~ No, obviously not, because they've been cleaned by the time they get to.warn_a11ytable()
).