a11ytables icon indicating copy to clipboard operation
a11ytables copied to clipboard

YAML for table specification

Open mattkerlogue opened this issue 2 years ago • 1 comments

Consider using YAML files to guide table construction.

title: The 'mtcars' Demo Dataset
description: >
  Aspects of automobile design and performance.
properties: >
  Suppressed values are replaced with the value ['c'].
  
  Blank cells in the 'Notes' column indicate the absence of a note.
contact: >
    The mtcars Team, telephone: 012 3456 789

tables:
  - name: Table 1
    title: Car Road Tests 1
    source: Motor Trend (1974)
    file: table1.csv
  - name: Table 2
    title: Car Road Tests 2
    source: Motor Trend (1974)
    file: table2.csv

notes:
  - number: 1
    description: US gallons
  - number: 2
    description: >
      Retained to enable comparisons with previous analyses.

Processing steps:

  1. The cover page can be generated from the head elements, title, description, properties, contact.
  2. The contents can be generated from the information in the tables list (using the name and title components) and the existence (or otherwise) of the notes list.
  3. The notes list can be coerced into a table.
  4. The file property of a tables list gives the file that the tables come from, if preferable you can have function to read and check these conform, potentially only allow specific formats (e.g. only CSV/RDS).

yaml::read_yaml() will read a YAML file and return an R list.

mattkerlogue avatar Apr 27 '22 13:04 mattkerlogue