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

Make the cover table requirement more user friendly #25

Closed matt-dray closed 2 years ago

matt-dray commented 2 years ago

We should alter the way that users provide the cover table to make it more user-friendly and intuitive. This will be a breaking change.

Currently, the information on the cover page should be aranged so there's a title, then subtitle-body pairs down the sheet. This is because the styling functions are naive and apply alternating title style then body style.

Here's what the table currently looks like for the built-in lfs_tables object:

> filter(lfs_tables, sheet_type == "cover") |> pull(table)
[[1]]
# A tibble: 17 × 1
   A                                                                                                                                 
   <chr>                                                                                                                             
 1 "Labour market overview, UK: December 2020"
 2 "Publication dates"
 3 "The next publication was published at 7:00am 26 January 2021."
 4 "Note on weighting methodology"
 5 "More information about the impact of COVID19 on the Labour Force Survey"
 6 "Dataset identifier codes"
 7 "The four-character identification codes appearing in the tables are the ONS' references for the data series." 
...

Rows 2 and 3 are a subtitle/body pair, so are rows 4 and 5, etc.

In other words, the users needs to supply a single-column dataframe (where the column name doesn't matter) for the cover sheet when constructing their a11ytable object. I think this is pretty unintuitive.

Better:

For example:

> tibble::tribble(
+     ~subtitle, ~sub_body,
+     "Publication dates", "The next publication was published at 7:00am 26 January 2021.",
+     "Note on weighting methodology", "More information about the impact of COVID19 on the Labour Force Survey",
+     "Dataset identifier codes", "The four-character identification codes appearing in the tables are the ONS' references for the data series."
+ )
# A tibble: 3 × 2
  subtitle                      sub_body                                                                                             
  <chr>                         <chr>                                                                                                
1 Publication dates             The next publication was published at 7:00am 26 January 2021.                                        
2 Note on weighting methodology More information about the impact of COVID19 on the Labour Force Survey                              
3 Dataset identifier codes      The four-character identification codes appearing in the tables are the ONS' references for the data…

The logic of create_a11y_wb() can then handle the translation of this format into the single column required during workbook construction.