{"id":17795206,"url":"https://github.com/matt-dray/a11ytables2","last_synced_at":"2026-02-01T22:02:05.776Z","repository":{"id":193034469,"uuid":"687210331","full_name":"matt-dray/a11ytables2","owner":"matt-dray","description":":1234::two: [WIP] R package: generate best-practice stats spreadsheets for publication ","archived":false,"fork":false,"pushed_at":"2024-09-20T18:40:33.000Z","size":46,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T13:36:13.287Z","etag":null,"topics":["accessibility","openxlsx2","reproducible-analytical-pipeline","rstats","spreadsheet"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matt-dray.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-04T22:08:31.000Z","updated_at":"2025-04-11T14:37:07.000Z","dependencies_parsed_at":"2023-12-27T22:44:15.617Z","dependency_job_id":"a9d0e2ef-0968-42f6-9f11-7670121abb69","html_url":"https://github.com/matt-dray/a11ytables2","commit_stats":null,"previous_names":["matt-dray/a11ytables2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matt-dray/a11ytables2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fa11ytables2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fa11ytables2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fa11ytables2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fa11ytables2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matt-dray","download_url":"https://codeload.github.com/matt-dray/a11ytables2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-dray%2Fa11ytables2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28992639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T22:01:13.024Z","status":"ssl_error","status_checked_at":"2026-02-01T21:57:32.026Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessibility","openxlsx2","reproducible-analytical-pipeline","rstats","spreadsheet"],"created_at":"2024-10-27T11:25:06.649Z","updated_at":"2026-02-01T22:02:05.760Z","avatar_url":"https://github.com/matt-dray.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# {a11ytables2}\n\n\u003c!-- badges: start --\u003e\n[![Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept.](https://www.repostatus.org/badges/latest/concept.svg)](https://www.repostatus.org/#concept)\n\u003c!-- badges: end --\u003e\n\n## Purpose\n\nGenerate spreadsheet publications that follow [best-practice guidance from the UK Government's Analysis Function](https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/).\n\nThis package is a work-in-progress concept to experiment with new methods for [the {a11ytables} package](https://github.com/co-analysis/a11ytables). It may never be fully-featured or complete.\n\n## Install\n\nInstall from GitHub via {remotes}:\n\n```{r}\n#| label: install-github\n#| eval: false\nremotes::install_github(\"matt-dray/a11ytables2\")\n```\n\n## Workflow\n\nThe basic workflow involves building a 'blueprint': a list object that contains all the information needed to create an output workbook.\n\nFirst, let's define some demo data that represents a table of statistical data to be published.\n\n```{r}\n#| label: dummy-data\nmtcars_x \u003c- mtcars[6:10, 1:5]\nmtcars_x[2, 2] \u003c- \"[note 1]\"\n```\n\nNow we can create our list blueprint (`new_blueprint()`) and build it up sheet by sheet, with specialised functions to add each sheet required by the best-practice standards (`append_cover()`, `append_contents()`, `append_notes()`, `append_tables()`). Each function has its own checks and arguments.\n\n```{r}\n#| label: blueprint\nlibrary(a11ytables2)\n\nblueprint \u003c- \n  new_blueprint() |\u003e  # initiate blueprint list\n  append_cover(\n    title = \"I am a Test Workbook\",\n    sections = list(  # element names are headers, vector elements are new lines\n      \"First Section\" = \"This is some text.\",\n      \"Second Section\" = c(\"This is some text.\", \"This is some more text.\"),\n      \"Third Section\" = c(\"This is some text.\", \"This is some more text\", \"Even more.\"),\n      \"Fourth Section\" = \"This is some text.\"\n    )\n  ) |\u003e \n  append_contents(\n    table = data.frame(\n      Tab = c(\"Notes\", \"Table_1\"),\n      Description = c(\"The notes page.\", \"The first table [note 5].\")\n    )\n  ) |\u003e\n  append_notes(\n    table = data.frame(\n      Note = c(\"[note 1]\", \"[note 2]\"),\n      Description = c(\"This is a note.\", \"This is another note\")\n    )\n  ) |\u003e \n  append_tables(\n    sheet_name = \"Table_1\",  # will appear as the tab name in the workbook\n    title = \"The Title 1 [note 3]\",\n    subtitle = \"The subtitle 1\",\n    custom = c(  # arbitrary pre-table information\n      x = \"A custom row\",\n      y = \"Another custom row\",\n      \"A third.\"\n    ),\n    source = \"The source.\",\n    tables = mtcars_x\n  ) |\u003e \n  append_tables(  # this worksheet has two tables\n    sheet_name = \"Table_2\",\n    title = \"The Title 2\",\n    subtitle = \"The subtitle 2\",\n    source = \"The source 2.\",\n    tables = list(  # provide multiple tables in list format\n      \"Subtable 2.1\" = mtcars[1:5, 1:5],\n      \"Subtable 2.2\" = mtcars_x\n    )\n  )\n```\n\n\u003cdetails\u003e\u003csummary\u003eClick to see the structure of the blueprint object.\u003c/summary\u003e\n\n```{r}\n#| label: structure\nstr(blueprint, 3)\n```\n\n\u003c/details\u003e\n\nOnce we have the blueprint list, we can add spreadsheet structure and style by converting to an {openxlsx2} wbWorkbook-class object:\n\n```{r}\n#| label: generate-workbook\nwb \u003c- generate_workbook(blueprint)\nwb\n```\n\nWe can then apply some further manipulation to our wbWorkbook-class object to finesse it for our needs. For example, we can set the number format to 'General' for Table 1:\n\n```{r}\n#| label: numfmt\nwb$add_numfmt(sheet = \"Table_1\", dims = \"A10:E14\", numfmt = \"General\")\n```\n\nAnd finally we can open a temporary copy of the workbook for inspection:\n\n```{r}\n#| label: open\n#| eval: false\nwb |\u003e openxlsx2::wb_open()\n```\n\nUse `openxlsx2::wb_save()` instead to save to disk.\n\n## Comparison to {a11ytables}\n\nImprovements in {a11ytables2} compared to {a11ytables} include:\n\n* [{openxlsx2}](https://janmarvin.github.io/openxlsx2/) for the back-end, rather than [{openxlsx}](https://ycphs.github.io/openxlsx/index.html)\n* greater user control by building up with an `append_*()` function family\n* greater flexibility to provide arbitrary pre-table content via `custom()` argument\n* support for multiple tables per sheet\n\n## Related projects\n\nActively-used packages include:\n\n* [{a11ytables}](https://github.com/co-analysis/a11ytables) for R\n* [{rapid.spreadsheets}](https://github.com/RAPID-ONS/rapid.spreadsheets) for R\n* ['gptables'](https://github.com/best-practice-and-impact/gptables) for Python\n\nAnother experimental project that builds on {a11ytables}:\n\n* [{yamlsheets}](https://github.com/matt-dray/yamlsheets) for R\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-dray%2Fa11ytables2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatt-dray%2Fa11ytables2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-dray%2Fa11ytables2/lists"}